Пример #1
0
 public object visitVarStatement(Statement.Var varStmt)
 {
     declare(varStmt.name);
     if (varStmt.initializer != null)
     {
         resolve(varStmt.initializer);
     }
     define(varStmt.name);
     return(null);
 }
Пример #2
0
        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);
        }