From e283991f902c38af8e6b5c6ae299911d120d8bcf Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 16 Feb 2021 23:41:24 -0800 Subject: Add local functions and closures --- src/com/craftinginterpreters/lox/Interpreter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/com/craftinginterpreters/lox/Interpreter.java') 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, Stmt.Visitor { @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; } -- cgit v1.2.3-54-g00ecf