SetFlowControl() private method

private SetFlowControl ( BlockReturnReason reason, IronRuby.Runtime.RuntimeFlowControl targetFrame, ProcKind sourceProcKind ) : void
reason BlockReturnReason
targetFrame IronRuby.Runtime.RuntimeFlowControl
sourceProcKind ProcKind
return void
        private static void YieldBlockBreak(RuntimeFlowControl rfc, BlockParam /*!*/ ownerBlockFlowControl, BlockParam /*!*/ yieldedBlockFlowControl, object returnValue)
        {
            Assert.NotNull(ownerBlockFlowControl, yieldedBlockFlowControl);

            // target proc-converter:
            RuntimeFlowControl targetFrame = yieldedBlockFlowControl.TargetFrame;

            Debug.Assert(targetFrame != null);

            if (targetFrame.IsActiveMethod)
            {
                if (targetFrame == rfc)
                {
                    // The current primary super-frame is the proc-converter, however we are still in the block frame that needs to be unwound.
                    // Sets the owner's BFC to exit the current block (recursively up to the primary frame).
                    ownerBlockFlowControl.SetFlowControl(BlockReturnReason.Break, targetFrame, yieldedBlockFlowControl.SourceProcKind);
                    return;
                }
                else
                {
                    throw new MethodUnwinder(targetFrame, returnValue);
                }
            }
            else
            {
                throw new LocalJumpError("break from proc-closure");
            }
        }
 public static object BlockRetry(BlockParam/*!*/ blockFlowControl) {
     if (blockFlowControl.CallerKind == BlockCallerKind.Yield) {
         blockFlowControl.SetFlowControl(BlockReturnReason.Retry, null, blockFlowControl.Proc.Kind);
         return RetrySingleton;
     } else {
         throw new LocalJumpError("retry from proc-closure");
     }
 }
 public static object BlockRetry(BlockParam /*!*/ blockFlowControl)
 {
     if (blockFlowControl.CallerKind == BlockCallerKind.Yield)
     {
         blockFlowControl.SetFlowControl(BlockReturnReason.Retry, null, blockFlowControl.Proc.Kind);
         return(RetrySingleton);
     }
     else
     {
         throw new LocalJumpError("retry from proc-clause");
     }
 }
        // post-yield return ops:

        private static void YieldBlockReturn(BlockParam /*!*/ blockFlowControl, object returnValue)
        {
            if (blockFlowControl.CallerKind == BlockCallerKind.Yield)
            {
                blockFlowControl.SetFlowControl(BlockReturnReason.Return, null, blockFlowControl.Proc.Kind);
            }
            else
            {
                // if the block is called we can't continue fast stack unwinding:
                throw ((BlockReturnResult)returnValue).ToUnwinder();
            }
        }
Beispiel #5
0
 // post-yield return ops:
 private static void YieldBlockReturn(BlockParam/*!*/ blockFlowControl, object returnValue)
 {
     if (blockFlowControl.CallerKind == BlockCallerKind.Yield) {
         blockFlowControl.SetFlowControl(BlockReturnReason.Return, null, blockFlowControl.Proc.Kind);
     } else {
         // if the block is called we can't continue fast stack unwinding:
         throw ((BlockReturnResult)returnValue).ToUnwinder();
     }
 }
Beispiel #6
0
        private static void YieldBlockBreak(RuntimeFlowControl rfc, BlockParam/*!*/ ownerBlockFlowControl, BlockParam/*!*/ yieldedBlockFlowControl, object returnValue) {
            Assert.NotNull(ownerBlockFlowControl, yieldedBlockFlowControl);

            // target proc-converter:
            RuntimeFlowControl targetFrame = yieldedBlockFlowControl.TargetFrame;
            Debug.Assert(targetFrame != null);

            if (targetFrame.IsActiveMethod) {
                if (targetFrame == rfc) {
                    // The current primary super-frame is the proc-converter, however we are still in the block frame that needs to be unwound.
                    // Sets the owner's BFC to exit the current block (recursively up to the primary frame).
                    ownerBlockFlowControl.SetFlowControl(BlockReturnReason.Break, targetFrame, yieldedBlockFlowControl.SourceProcKind);
                    return;
                } else {
                    throw new MethodUnwinder(targetFrame, returnValue);
                }
            } else {
                throw new LocalJumpError("break from proc-closure");
            }
        }