Implemented callable expressions in AST and Interpret

pull/37/head
ondra05 2021-08-01 18:30:07 +02:00
parent 3d29ae19ae
commit f3c4ede084
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ pub enum StmtKind {
code: Vec<u8>,
},
Call {
iden: Iden,
expr: Expr,
args: Vec<Expr>,
},
Print(Expr),

View File

@ -267,8 +267,8 @@ impl ExecEnv {
return self.eval_stmts_hs(&body.block, true);
}
}
StmtKind::Call { iden, args } => {
let func = self.get_var(iden)?;
StmtKind::Call { expr, args } => {
let func = self.eval_expr(expr)?;
if let Value::Functio(func) = func {
self.fn_call(func, args, &stmt.span)?;