This commit is contained in:
numzero 2025-04-19 12:30:41 +03:00
parent 4033495353
commit eb51dd2702

View File

@ -149,7 +149,20 @@ fn build_in_scope(parent: &BuildContext<'_>, code: &ast::Function) -> Function {
source: Box::new(build_expression(&scope, source)), source: Box::new(build_expression(&scope, source)),
}); });
} }
ast::Statement::Call { callee, args } => todo!(), ast::Statement::Call { callee, args } => {
body.push(Statement::Call(Call {
callee: Box::new(build_expression(
&scope,
&ast::Expression::Variable(ast::Location::Variable {
name: callee.clone(),
}),
)),
args: args
.iter()
.map(|arg| build_expression(&scope, arg))
.collect(),
}));
}
ast::Statement::Local { name, init } => { ast::Statement::Local { name, init } => {
let init = init.as_ref().map(|init| build_expression(&scope, &init)); let init = init.as_ref().map(|init| build_expression(&scope, &init));
let id = scope.scope.borrow_mut().add_local(&name); let id = scope.scope.borrow_mut().add_local(&name);