From eb51dd2702d62e7e68985b5ae078374d3d2de35f Mon Sep 17 00:00:00 2001 From: numzero Date: Sat, 19 Apr 2025 12:30:41 +0300 Subject: [PATCH] calls! --- src/twopass.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/twopass.rs b/src/twopass.rs index ce3aeb6..8c5a6c8 100644 --- a/src/twopass.rs +++ b/src/twopass.rs @@ -149,7 +149,20 @@ fn build_in_scope(parent: &BuildContext<'_>, code: &ast::Function) -> Function { 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 } => { let init = init.as_ref().map(|init| build_expression(&scope, &init)); let id = scope.scope.borrow_mut().add_local(&name);