public object VisitFunctionStmt(Stmt.Function stmt) { var function = new LoxFunction(stmt, environment, false); environment.Define(stmt.name.Lexeme, function); return(null); }
public Unit VisitFunction(Stmt.Function stmt) { Declare(stmt.Name); Define(stmt.Name); ResolveFunction(stmt, FunctionType.Function); return(Unit.Default); }
object Stmt.IVisitor <object> .VisitFunctionStmt(Stmt.Function stmt) { LoxFunction function = new LoxFunction(stmt, environment, false); environment.Define(stmt.name.lexeme, function); return(null); }
public Void Visit(Stmt.Function stmt) { var function = new LoxFunction(stmt, environment, false); environment.Define(stmt.Name.Lexeme, function); return(Void.Instance); }
object Stmt.IVisitor <object> .VisitFunctionStmt(Stmt.Function stmt) { Declare(stmt.name); Define(stmt.name); ResolveFunction(stmt, FunctionType.FUNCTION); return(null); }
public Unit VisitFunction(Stmt.Function stmt) { // Capture the environment at declaration time. string name = string.Format("<fun {0}>", stmt.Name.Lexeme); var function = new LoxFunction(name, _environment, stmt.Parameters, stmt.Body); _environment.Define(stmt.Name.Lexeme, function); return(Unit.Default); }
public Void Visit(Stmt.Function stmt) { Declare(stmt.Name); Define(stmt.Name); ResolveFunction(stmt, FunctionType.Function); return(Void.Instance); }
void ResolveFunction(Stmt.Function function, FunctionType type) { var enclosingFunction = currentFunction; currentFunction = type; BeginScope(); function.parameters.ForEach(e => { Declare(e); Define(e); }); Resolve(function.Body); EndScope(); currentFunction = enclosingFunction; }
private void ResolveFunction(Stmt.Function function, FunctionType type) { FunctionType enclosingFunction = currentFunction; currentFunction = type; BeginScope(); foreach (Token p in function.parameters) { Declare(p); Define(p); } Resolve(function.body); EndScope(); currentFunction = enclosingFunction; }
public string VisitFunction(Stmt.Function stmt) { var builder = new StringBuilder(); builder.Append("(fun ("); builder.Append(stmt.Name.Lexeme); foreach (var param in stmt.Parameters) { builder.Append(" "); builder.Append(param.Lexeme); } builder.Append(")"); foreach (var s in stmt.Body) { builder.Append(s.Accept(this)); } return(builder.ToString()); }
private void ResolveFunction(Stmt.Function function, FunctionType type) { var enclosingFunction = currentFunction; currentFunction = type; BeginScope(); foreach (var param in function.Parameters) { Declare(param); Define(param); } Resolve(function.Body); EndScope(); currentFunction = enclosingFunction; }
public LoxFunction(Stmt.Function declaration, Environment closure, bool isInitializer) { this.isInitializer = isInitializer; this.closure = closure; this.declaration = declaration; }
private void ResolveFunction(Stmt.Function stmt, FunctionType type) { ResolveFunction(type, stmt.Parameters, stmt.Body); }
public LoxFunction(Stmt.Function declaration, Environment closure, bool isInitializer) { _declaration = declaration; _closure = closure; _isInitializer = isInitializer; }