Пример #1
0
 public object VisitVarStmt(Stmt.Var stmt)
 {
     Declare(stmt.Name);
     if (stmt.Initializer != null)
     {
         Resolve(stmt.Initializer);
     }
     Define(stmt.Name);
     return(null);
 }
Пример #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);
        }