public string VisitVarStmt(Stmt.Var stmt) { if (stmt.Initializer == null) { return(Parenthesize2("var", stmt.Name)); } return(Parenthesize2("var", stmt.Name, "=", stmt.Initializer)); }
public object VisitVarStmt(Stmt.Var stmt) { Declare(stmt.Name); if (stmt.Initializer != null) { Resolve(stmt.Initializer); } Define(stmt.Name); return(null); }
public object VisitVarStmt(Stmt.Var stmt) { object value = null; if (stmt.Initializer != null) { value = Evaluate(stmt.Initializer); } _environment.Define(stmt.Name.Lexeme, value); return(null); }