diff options
author | Tom Willemse | 2021-02-17 22:06:55 -0800 |
---|---|---|
committer | Tom Willemse | 2021-02-17 22:06:55 -0800 |
commit | a0df1715fcefd422a0cdd0d247c79cd966b304d5 (patch) | |
tree | 2197617e98edb77624165bbaa528afe152ca7181 /src/com/craftinginterpreters/lox/Interpreter.java | |
parent | 4fbfa53dd79a84465256010a263dd4863e93032c (diff) | |
download | crafting-interpreters-a0df1715fcefd422a0cdd0d247c79cd966b304d5.tar.gz crafting-interpreters-a0df1715fcefd422a0cdd0d247c79cd966b304d5.zip |
Add anonymous functionschapter-10-challenges
Diffstat (limited to 'src/com/craftinginterpreters/lox/Interpreter.java')
-rw-r--r-- | src/com/craftinginterpreters/lox/Interpreter.java | 5 |
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); |