Пример #1
0
 public LoopInterruptInfo(ILoopInterrupt interrupt, ExecutionMode mode)
 {
     this.Interrupt = interrupt;
     this.Mode      = mode;
     // we increase the jump reach to make room for "break" case
     // we multiply by two, to have easy distinction between continue and break
     this.JumpReach = (interrupt.AssociatedLoop.EnclosingScopesToRoot().Count() + 1) * 2;
     // "break" reaches further so we decrease the reach
     if (this.Interrupt.IsBreak)
     {
         --this.JumpReach;
     }
 }
Пример #2
0
        internal void AddInterruption(ILoopInterrupt interrupt)
        {
            if (interrupt.AssociatedLoop == null) // invalid interrupt, ignore
            {
                return;
            }

            LoopInterruptInfo exit;

            if (this.interruptions.TryGetValue(interrupt, out exit))
            {
                exit.Mode = ExecutionMode.Unreachable;
            }
            else
            {
                this.interruptions.Add(interrupt, new LoopInterruptInfo(interrupt, ExecutionMode.Unreachable));
            }
        }