Exemple #1
0
 public object visitVarStmt(Stmt.Var stmt)
 {
     declare(stmt.name);
     if (stmt.initializer != null)
     {
         resolve(stmt.initializer);
     }
     define(stmt.name);
     return(null);
 }
Exemple #2
0
        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);
        }