aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/craftinginterpreters/lox/Interpreter.java
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-02-17 22:06:55 -0800
committerGravatar Tom Willemse2021-02-17 22:06:55 -0800
commita0df1715fcefd422a0cdd0d247c79cd966b304d5 (patch)
tree2197617e98edb77624165bbaa528afe152ca7181 /src/com/craftinginterpreters/lox/Interpreter.java
parent4fbfa53dd79a84465256010a263dd4863e93032c (diff)
downloadcrafting-interpreters-chapter-10-challenges.tar.gz
crafting-interpreters-chapter-10-challenges.zip
Add anonymous functionschapter-10-challenges
Diffstat (limited to 'src/com/craftinginterpreters/lox/Interpreter.java')
-rw-r--r--src/com/craftinginterpreters/lox/Interpreter.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/craftinginterpreters/lox/Interpreter.java b/src/com/craftinginterpreters/lox/Interpreter.java
index 3e3be86..b4efd5c 100644
--- a/src/com/craftinginterpreters/lox/Interpreter.java
+++ b/src/com/craftinginterpreters/lox/Interpreter.java
@@ -159,6 +159,11 @@ class Interpreter implements Expr.Visitor<Object>, Stmt.Visitor<Void> {
}
@Override
+ public Object visitLambdaExpr(Expr.Lambda expr) {
+ return new LoxLambda(expr, environment);
+ }
+
+ @Override
public Void visitIfStmt(Stmt.If stmt) {
if (isTruthy(evaluate(stmt.condition))) {
execute(stmt.thenBranch);