コード例 #1
0
 void ITreeWalker.Visit(WhileStatement statement)
 {
     statement.Validate(this);
     statement.Condition.Accept(this);
     _loops.Push(statement);
     statement.Body.Accept(this);
     _loops.Pop();
 }
コード例 #2
0
        void ITreeWalker.Visit(WhileStatement statement)
        {
            statement.Validate(this);

            InsertWhile(() => statement.Condition.Accept(this), () =>
            {
                _loops.Push(true);
                statement.Body.Accept(this);
                _loops.Pop();
            });
        }
コード例 #3
0
        void ITreeWalker.Visit(WhileStatement statement)
        {
            statement.Validate(this);
            var start = _operations.Count;

            statement.Condition.Accept(this);
            _operations.Add(PopIfOperation.Instance);
            var jump = InsertMarker();

            _loops.Push(new LoopInfo {
                Break = jump, Continue = start
            });
            statement.Body.Accept(this);
            _loops.Pop();
            _operations.Add(new JumpOperation(start - 1));
            var end = _operations.Count;

            _operations[jump] = new JumpOperation(end - 1);
        }