示例#1
0
        public object Visit(While stmt)
        {
            while (CheckIsTruthy(Evaluate(stmt.cond)))
            {
                Token signal = (Token)Execute(stmt.body);

                if (signal != null && signal.type == BREAK)
                {
                    break;
                }
            }

            return(null);
        }
示例#2
0
        public object Visit(While stmt)
        {
            LoopType enclosingLoopType = currentLoopType;

            currentLoopType = LoopType.WHILE;

            BeginScope();
            Resolve(stmt.cond);
            Resolve(stmt.body);
            EndScope();

            currentLoopType = enclosingLoopType;
            return(null);
        }