public object visitFunctionStmt(Stmt.Function stmt) { var function = new RosellaFunction(stmt, environment); environment.define(stmt.name.lexeme, function); return(null); }
public object visitFunctionStmt(Stmt.Function stmt) { declare(stmt.name); define(stmt.name); resolveFunction(stmt, FunctionType.FUNCTION); return(null); }
private void resolveFunction(Stmt.Function function, FunctionType type) { var enclosingFunction = currentFunction; currentFunction = type; beginScope(); foreach (var param in function.@params) { declare(param); define(param); } resolve(function.body); endScope(); currentFunction = enclosingFunction; }
public RosellaFunction(Stmt.Function declaration, RosellaEnvironment closure) { this.declaration = declaration; this.closure = closure; }