aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/craftinginterpreters/lox/Interpreter.java
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-02-16 23:41:24 -0800
committerGravatar Tom Willemse2021-02-16 23:41:24 -0800
commite283991f902c38af8e6b5c6ae299911d120d8bcf (patch)
treec58270e72017eb70b677c8b7ffcbf8b8a04cfc80 /src/com/craftinginterpreters/lox/Interpreter.java
parent0dbf155da52c5db1cab2688b04c87386a55c5d5b (diff)
downloadcrafting-interpreters-e283991f902c38af8e6b5c6ae299911d120d8bcf.tar.gz
crafting-interpreters-e283991f902c38af8e6b5c6ae299911d120d8bcf.zip
Add local functions and closures
Diffstat (limited to 'src/com/craftinginterpreters/lox/Interpreter.java')
-rw-r--r--src/com/craftinginterpreters/lox/Interpreter.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/craftinginterpreters/lox/Interpreter.java b/src/com/craftinginterpreters/lox/Interpreter.java
index 4549e11..3e3be86 100644
--- a/src/com/craftinginterpreters/lox/Interpreter.java
+++ b/src/com/craftinginterpreters/lox/Interpreter.java
@@ -153,7 +153,7 @@ class Interpreter implements Expr.Visitor<Object>, Stmt.Visitor<Void> {
@Override
public Void visitFunctionStmt(Stmt.Function stmt) {
- LoxFunction function = new LoxFunction(stmt);
+ LoxFunction function = new LoxFunction(stmt, environment);
environment.define(stmt.name.lexeme, function);
return null;
}