예제 #1
0
        public static TryFlowResult Analyze(Statement statement)
        {
            if (statement == null)
            {
                return(new TryFlowResult());
            }
            else
            {
                // find it now.
                TryFlowAnalyzer tfa = new TryFlowAnalyzer();
                tfa.WalkNode(statement);

                Debug.Assert(tfa._nesting == 0);
                Debug.Assert(tfa._switch == 0);

                return(tfa._result);
            }
        }
예제 #2
0
        public override void Emit(CodeGen cg)
        {
            // Codegen is affected by presence/absence of loop control statements
            // (break/continue) or return/yield statement in finally clause
            TryFlowResult flow = TryFlowAnalyzer.Analyze(FinallyStatement);

            //cg.EmitPosition(Start, _header);

            // If there's a yield anywhere, go for a complex codegen
            if (YieldInBlock(_tryYields) || _yieldInCatch || YieldInBlock(_finallyYields))
            {
                EmitGeneratorTry(cg, flow);
            }
            else
            {
                EmitSimpleTry(cg, flow);
            }
        }
예제 #3
0
        public static TryFlowResult Analyze(Statement statement)
        {
            if (statement == null) {
                return new TryFlowResult();
            } else {
                // find it now.
                TryFlowAnalyzer tfa = new TryFlowAnalyzer();
                tfa.WalkNode(statement);

                Debug.Assert(tfa._nesting == 0);
                Debug.Assert(tfa._switch == 0);

                return tfa._result;
            }
        }