public Void visitFunctionStmt(Stmt.Function stmt) { Declare(stmt.name); Define(stmt.name); ResolveFunction(stmt, FunctionType.FUNCTION); return(null); }
public Void visitFunctionStmt(Stmt.Function stmt) { Function fn = new Function(stmt, environment); if (stmt.name != null) { environment.Define(stmt.name.lexeme, fn); } return(null); }
private void ResolveFunction(Stmt.Function fn, FunctionType type) { FunctionType enclosingFunctionType = currentFunction; currentFunction = type; BeginScope(); foreach (Token parameter in fn.parameters) { Declare(parameter); Define(parameter); } Resolve(fn.body); EndScope(); currentFunction = enclosingFunctionType; }
public Function(Stmt.Function declaration, Env closure) { this.declaration = declaration; this.closure = closure; }