Skip to content

Commit

Permalink
Update skip simplified variable just defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
YSawc committed Oct 27, 2020
1 parent 618018d commit 516ef95
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ fn main() {
}
}

if args.len() > 3 {
if args[3] == "simplified" {
fsimplified = true;
}
}

if arg1 == "repl" {
loop {
print!("> ");
Expand Down
2 changes: 1 addition & 1 deletion src/simplified/simplified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl NodeSt {
_ => unreachable!(),
}
}
NodeKind::Num(_) | NodeKind::UnderScore => (),
NodeKind::Num(_) | NodeKind::UnderScore | NodeKind::NewVar(_) => (),
_ => unreachable!(),
};
self
Expand Down
6 changes: 4 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ echo "All x86_64 test passed!\n"
assert_llvm() {
expected="$1"
input="$2"
ll="$3"
simplified="$3"

echo "Starts llvm tests!"
echo "------------------------------"
echo "[[rust output]]"
cargo run "$2" ll && lli ./workspace/tmp.ll
cargo run "$2" ll "$3" && lli ./workspace/tmp.ll
actual="$?"

echo "[[ shell output ]]"
Expand All @@ -112,6 +112,8 @@ assert_llvm 0 'fn { _ }'
assert_llvm 0 'fn { int _a = 3*4; _ }'
assert_llvm 7 'fn int { int a = 3+4; return a; }'
assert_llvm 12 'fn int { int a = 3*4; a }'
assert_llvm 8 'fn int { int _a = 3*4; 2+3*2 }' simplified
assert_llvm 8 'fn int { int _a = 3*4; int _b = 6/2; 2+3*2 }' simplified

echo "------------------------------"
echo "All llvm test passed!\n"

0 comments on commit 516ef95

Please sign in to comment.