Add Function to AST
This commit is contained in:
parent
fe0d46ecf3
commit
528545f71d
|
|
@ -31,6 +31,12 @@ pub enum Expression {
|
|||
callee: Ident,
|
||||
args: Vec<Expression>,
|
||||
},
|
||||
Function {
|
||||
name: Option<Ident>,
|
||||
args: Vec<Ident>,
|
||||
body: Vec<Statement>,
|
||||
ret: Option<Box<Expression>>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ impl Eval for Expression {
|
|||
let args = args.iter().map(|arg| arg.eval(scope)).collect();
|
||||
(function.inner)(scope, args)
|
||||
}
|
||||
Expression::Function { .. } => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user