public object VisitFunctionStmt(Stmt.Function stmt) { BasilFunction function = new BasilFunction(stmt, environment, false); 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) { FunctionType enclosingFunction = currentFunction; currentFunction = type; BeginScope(); foreach (var param in function.parameters) { Declare(param); Define(param); } Resolve(function.body); EndScope(); currentFunction = enclosingFunction; }
public BasilFunction(Stmt.Function declaration, Environment closure, bool isInitializer) { this.declaration = declaration; this.closure = closure; this.isInitializer = isInitializer; }