void ITreeWalker.Visit(CaseStatement statement)
 {
     statement.Validate(this);
     statement.Condition.Accept(this);
     _loops.Push(statement);
     statement.Body.Accept(this);
     _loops.Pop();
 }
예제 #2
0
        void ITreeWalker.Visit(CaseStatement statement)
        {
            var loop = _loops.Pop();

            statement.Validate(this);
            _operations.Add(new GetsOperation("^~#" + _loops.Count));
            statement.Condition.Accept(this);
            _operations.Add(new GetcOperation(1));
            _operations.Add(PopIfOperation.Instance);
            var jumpToNext = InsertMarker();

            _loops.Push(new LoopInfo {
                Break = loop.Break, Continue = jumpToNext
            });
            statement.Body.Accept(this);
            var end = _operations.Count;

            InsertJump(jumpToNext, end - 1);
        }
예제 #3
0
 void ITreeWalker.Visit(CaseStatement statement)
 {
     statement.Validate(this);
     InsertCase(() => statement.Condition.Accept(this), () => statement.Body.Accept(this));
 }