Interpreter - Handle references to "this"

This commit is contained in:
Emmanuel BENOîT 2023-01-09 08:03:41 +01:00
parent f9359cfe03
commit e46b399399

View file

@ -348,7 +348,9 @@ impl Interpretable for ExprNode {
ExprNode::Unary { operator, right } => self.on_unary(es, operator, right),
ExprNode::Grouping { expression } => expression.interpret(es),
ExprNode::Litteral { value } => self.on_litteral(value),
ExprNode::Variable(var_expr) => Ok(es.lookup_var(var_expr)?.into()),
ExprNode::Variable(var_expr) | ExprNode::This(var_expr) => {
Ok(es.lookup_var(var_expr)?.into())
}
ExprNode::Call {
callee,
right_paren,