Example #1
0
        public object Visit(Do stmt)
        {
            do
            {
                Token signal = (Token)Execute(stmt.body);

                if (signal != null && signal.type == BREAK)
                {
                    break;
                }
            } while (CheckIsTruthy(Evaluate(stmt.cond)));

            return(null);
        }
Example #2
0
        public object Visit(Do stmt)
        {
            LoopType enclosingLoopType = currentLoopType;

            currentLoopType = LoopType.DO;

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

            currentLoopType = enclosingLoopType;
            return(null);
        }