예제 #1
0
            public IteratorFinallyFrame(
                IteratorFinallyFrame parent,
                int finalizeState,
                IteratorFinally handler,
                HashSet<LabelSymbol> labels)
            {
                Debug.Assert(parent != null, "non root frame must have a parent");
                Debug.Assert((object)handler != null, "non root frame must have a handler");

                this.parent = parent;
                this.finalizeState = finalizeState;
                this.handler = handler;
                this.labels = labels;
            }
            public IteratorFinallyFrame(
                IteratorFinallyFrame parent,
                int finalizeState,
                IteratorFinally handler,
                HashSet <LabelSymbol> labels)
            {
                Debug.Assert(parent != null, "non root frame must have a parent");
                Debug.Assert((object)handler != null, "non root frame must have a handler");

                this.parent        = parent;
                this.finalizeState = finalizeState;
                this.handler       = handler;
                this.labels        = labels;
            }
예제 #3
0
        private IteratorFinally MakeSynthesizedFinally(int state)
        {
            // we can pick any name, but we will try to do
            // <>m__Finally1
            // <>m__Finally2
            // <>m__Finally3
            // . . .
            // that will roughly match native naming scheme and may also be easier when need to debug.
            string name = "<>m__Finally" + Math.Abs(state + 2);

            var containingType = F.CurrentClass;
            var finallyMethod  = new IteratorFinally(containingType, name);

            F.EmitModule.AddCompilerGeneratedDefinition(containingType, finallyMethod);

            return(finallyMethod);
        }
        private IteratorFinally MakeSynthesizedFinally(int state)
        {
            // we can pick any name, but we will try to do
            // <>m__Finally1
            // <>m__Finally2
            // <>m__Finally3
            // . . . 
            // that will roughly match native naming scheme and may also be easier when need to debug.
            string name = "<>m__Finally" + Math.Abs(state + 2);

            var containingType = F.CurrentClass;
            Debug.Assert(containingType != null);

            var finallyMethod = new IteratorFinally(containingType, name);

            F.ModuleBuilderOpt.AddSynthesizedDefinition(containingType, finallyMethod);

            return finallyMethod;
        }