build_expression!

This commit is contained in:
numzero 2025-04-19 12:37:44 +03:00
parent 03e8673b6f
commit d1e1d8ee5c

View File

@ -128,7 +128,12 @@ fn lookup(scope: &BuildContext<'_>, loc: &ast::Location) -> Location {
}
fn build_expression(scope: &BuildContext<'_>, code: &ast::Expression) -> Expression {
todo!()
match code {
ast::Expression::Constant(c) => Expression::Constant(c.clone()),
ast::Expression::Variable(loc) => Expression::Variable(lookup(scope, loc)),
ast::Expression::Call(call) => Expression::Call(build_call(scope, call)),
ast::Expression::Function(f) => Expression::Function(build_in_scope(scope, f)),
}
}
fn build_call(scope: &BuildContext<'_>, code: &ast::Call) -> Call {