Example #1
0
        public Void VisitVarStmt(Stmt.Var stmt)
        {
            Declare(stmt.name);

            if (stmt.initializer != null)
            {
                Resolve(stmt.initializer);
            }

            Define(stmt.name);

            return(null);
        }
Example #2
0
        public Void VisitVarStmt(Stmt.Var stmt)
        {
            object value = null;

            if (stmt.initializer != null)
            {
                value = Evaluate(stmt.initializer);
            }

            environment.Define(stmt.name.Lexeme, value);

            return(null);
        }