Debug ast rewrite

This commit is contained in:
greg
2018-05-11 02:58:14 -07:00
parent d7e3f695b7
commit e6f0710e41
3 changed files with 8 additions and 0 deletions

View File

@@ -72,6 +72,12 @@ impl Expression {
&BinExp(ref binop, ref lhs, ref rhs) => binop.reduce(lhs, rhs),
&PrefixExp(ref op, ref arg) => op.reduce(arg),
&Value(ref name) => Expr::Val(name.clone()),
/*
&Call { ref f, ref arguments } => Expr::Call {
f: Box<Expression>,
arguments: Vec<Expression>,
},
*/
e => Expr::UnimplementedSigilValue,
}
}

View File

@@ -96,6 +96,7 @@ fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi
type TempASTReduction = (ast_reducing::ReducedAST, parsing::AST);
fn ast_reducing(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result<TempASTReduction, String> {
let output = input.reduce();
comp.map(|comp| comp.add_artifact(TraceArtifact::new("ast_reducing", format!("{:?}", output))));
Ok((output, input))
}