Example #1
0
        public OnEnterLeaveResult Jump(IdContainer JumpTo, JumpMode Mode = JumpMode.Enter)
        {
            var Common  = Container.GetCommonContainer(JumpTo);
            var TryComm = Container.GetParent <Command>(x =>
                                                        x.Type == CommandType.Try && x.FinallyScope != null, Common);

            if (TryComm != null)
            {
                Container   = TryComm.FinallyScope;
                FinallyJump = new JumpDestination(JumpTo, Mode);
                return(OnEnterLeaveResult.EnterNew);
            }
            else
            {
                Container = JumpTo;
                if (Mode == JumpMode.Enter)
                {
                    return(OnEnterLeaveResult.EnterNew);
                }
                else if (Mode == JumpMode.Leave)
                {
                    return(OnEnterLeaveResult.LeaveNew);
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Mode");
                }
            }
        }
Example #2
0
 public IdContainer GetCommonContainer(IdContainer Container)
 {
     if (Container == this || Container.IsSubContainerOf(this))
     {
         return(this);
     }
     else if (Parent != null)
     {
         return(Parent.GetCommonContainer(Container));
     }
     else
     {
         return(null);
     }
 }