Пример #1
0
        public string VisitVarStmt(Stmt.Var stmt)
        {
            if (stmt.Initializer == null)
            {
                return(Parenthesize2("var", stmt.Name));
            }

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