public object visitVarStatement(Statement.Var varStmt) { declare(varStmt.name); if (varStmt.initializer != null) { resolve(varStmt.initializer); } define(varStmt.name); return(null); }
public object visitVarStatement(Statement.Var varStmt) { Object value = null; if (varStmt.initializer != null) { value = evaluate(varStmt.initializer); } if (value == null) { value = new Null(); } environment.define(varStmt.name.lexeme, value, varStmt.name); return(null); }