public object visitStmtFunctionStmt(StmtFunction stmt) { LoxFunction func = new LoxFunction(stmt, enviroment); enviroment.define(stmt.name.lexeme, func); return(null); }
public object visitStmtFunctionStmt(StmtFunction stmt) { declare(stmt.name); define(stmt.name); resolveFunction(stmt, FunctionType.FUNCTION); return(null); }
void resolveFunction(StmtFunction stmt, FunctionType fType) { FunctionType encFunction = currentFunction; currentFunction = fType; beginScope(); foreach (Token param in stmt.arguments) { declare(param); define(param); } resolve(stmt.body); endScope(); currentFunction = encFunction; }
public LoxFunction(StmtFunction _declaration, Enviroment _closure) { closure = _closure; declaration = _declaration; }