public object visit_Function_Stmt(GStmt.Function stmt) { LoxFunction function = new LoxFunction(stmt, environment, false); environment.define(stmt.name.lexeme, function); return(null); }
private void resolveFunction(GStmt.Function function, FunctionType type) { FunctionType enclosingFunction = currentFunction; currentFunction = type; beginScope(); foreach (Token param in function.parameters) { declare(param); define(param); } resolve(function.body); endScope(); currentFunction = enclosingFunction; }
public LoxFunction(GStmt.Function dec, Environment closure, bool isInitializer) { this.closure = closure; this.declaration = dec; this.isInitializer = isInitializer; }