Reduce redirections in Stmt.

This commit is contained in:
Stephen Chung
2021-03-09 23:30:48 +08:00
parent 8853ebf059
commit b11b8d6d39
6 changed files with 132 additions and 171 deletions

View File

@@ -54,8 +54,9 @@ fn test_optimizer_parse() -> Result<(), Box<EvalAltResult>> {
engine.set_optimization_level(OptimizationLevel::Simple);
let ast = engine.compile("{ const DECISION = false; if DECISION { 42 } else { 123 } }")?;
println!("{:?}", ast);
assert!(format!("{:?}", ast).starts_with(r#"AST { source: None, statements: [Block([Const(Ident("DECISION" @ 1:9), Some(BoolConstant(false, 1:20)), false, 1:3), Expr(IntegerConstant(123, 1:53))], 1:1)]"#));
assert!(format!("{:?}", ast).starts_with(r#"AST { source: None, statements: [Block([Const(BoolConstant(false, 1:20), Ident("DECISION" @ 1:9), 1:3), Expr(IntegerConstant(123, 1:53))], 1:1)], functions: Module("#));
let ast = engine.compile("if 1 == 2 { 42 }")?;