Interpreter - Handle AST refactorings
This commit is contained in:
parent
b12c7a05cf
commit
dbd0f6d20f
1 changed files with 15 additions and 11 deletions
|
@ -333,20 +333,24 @@ impl Interpretable for ExprNode {
|
||||||
es.assign_var(name, id, value)?;
|
es.assign_var(name, id, value)?;
|
||||||
Ok(InterpreterFlowControl::default())
|
Ok(InterpreterFlowControl::default())
|
||||||
}
|
}
|
||||||
ExprNode::Logical {
|
ExprNode::Logical(binary_expr) => self.on_logic(
|
||||||
left,
|
es,
|
||||||
operator,
|
&binary_expr.left,
|
||||||
right,
|
&binary_expr.operator,
|
||||||
} => self.on_logic(es, left, operator, right),
|
&binary_expr.right,
|
||||||
ExprNode::Binary {
|
),
|
||||||
left,
|
ExprNode::Binary(binary_expr) => self.on_binary(
|
||||||
operator,
|
es,
|
||||||
right,
|
&binary_expr.left,
|
||||||
} => self.on_binary(es, left, operator, right),
|
&binary_expr.operator,
|
||||||
|
&binary_expr.right,
|
||||||
|
),
|
||||||
ExprNode::Unary { operator, right } => self.on_unary(es, operator, right),
|
ExprNode::Unary { operator, right } => self.on_unary(es, operator, right),
|
||||||
ExprNode::Grouping { expression } => expression.interpret(es),
|
ExprNode::Grouping { expression } => expression.interpret(es),
|
||||||
ExprNode::Litteral { value } => self.on_litteral(value),
|
ExprNode::Litteral { value } => self.on_litteral(value),
|
||||||
ExprNode::Variable { name, id } => Ok(es.lookup_var(name, id)?.into()),
|
ExprNode::Variable(var_expr) => {
|
||||||
|
Ok(es.lookup_var(&var_expr.token, &var_expr.id)?.into())
|
||||||
|
}
|
||||||
ExprNode::Call {
|
ExprNode::Call {
|
||||||
callee,
|
callee,
|
||||||
right_paren,
|
right_paren,
|
||||||
|
|
Loading…
Reference in a new issue