Exemplo n.º 1
0
        void LeaveBlock(RunSharpFunc <Block, Label?> tryGetJumpLabel)
        {
            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;
                }


                Label?label = tryGetJumpLabel(blk);

                if (label != null)
                {
                    IL.Emit(useLeave ? OpCodes.Leave : OpCodes.Br, label.Value);
                    IsReachable = false;
                    return;
                }
            }

            throw new InvalidOperationException(Properties.Messages.ErrInvalidContinue);
        }
Exemplo n.º 2
0
        static bool FindApplicableInternal(ref List <ApplicableFunction> valid, ref bool expandedCandidates, IEnumerable <IMemberInfo> candidates, RunSharpFunc <IMemberInfo, ApplicableFunction> validate)
        {
            if (candidates == null)
            {
                return(false);
            }

            bool found = false;

            foreach (IMemberInfo candidate in candidates)
            {
                ApplicableFunction vc = validate(candidate);

                if (vc != null)
                {
                    found = true;

                    if (vc.IsExpanded)
                    {
                        expandedCandidates = true;
                    }

                    if (valid == null)
                    {
                        valid = new List <ApplicableFunction>();
                    }
                    valid.Add(vc);
                }
            }

            return(found);
        }