Exemple #1
0
        public IEnumerable <SymbolStatus> SymbolStatusesContinuableReverseOrdered(IContinuable continuable)
        {
            IEnumerable <SymbolStatus> SymbolStatusesContinuable(IContinuable continuable)
            {
                foreach (var stat in mSymbolStatus.Values.Where(v => v.Owned))
                {
                    yield return(stat);
                }

                if (Continuable == continuable)
                {
                    yield break;
                }

                if (Parent != null)
                {
                    foreach (var stat in Parent.SymbolStatusesContinuableReverseOrdered(continuable))
                    {
                        yield return(stat);
                    }
                }
            }

            return(SymbolStatusesContinuable(continuable).OrderByDescending(s => s.order));
        }
        public void Continue()
        {
            BeforeStatement();

            bool useLeave = false;

            foreach (Block blk in blocks)
            {
                ExceptionBlock xb = blk as ExceptionBlock;

                if (xb != null)
                {
                    if (xb.IsFinally)
                    {
                        throw new InvalidOperationException(Properties.Messages.ErrInvalidFinallyBranch);
                    }

                    useLeave = true;
                }

                IContinuable cntBlock = blk as IContinuable;

                if (cntBlock != null)
                {
                    il.Emit(useLeave ? OpCodes.Leave : OpCodes.Br, cntBlock.GetContinueTarget());
                    reachable = false;
                    return;
                }
            }

            throw new InvalidOperationException(Properties.Messages.ErrInvalidContinue);
        }
Exemple #3
0
        public void Continue()
        {
            BeforeStatement();

            bool useLeave = false;

            foreach (Block blk in blocks)
            {
                ExceptionBlock xb = blk as ExceptionBlock;

                if (xb != null)
                {
                    if (xb.IsFinally)
                    {
                        throw new InvalidOperationException("Cannot transfer control out of a finally handler");
                    }

                    useLeave = true;
                }

                IContinuable cntBlock = blk as IContinuable;

                if (cntBlock != null)
                {
                    il.Emit(useLeave ? OpCodes.Leave : OpCodes.Br, cntBlock.GetContinueTarget());
                    reachable = false;
                    return;
                }
            }

            throw new InvalidOperationException("Continue() called outside of a loop");
        }