Rhino.Interpreter.ContinuationJump.ContinuationJump C# (CSharp) Method

ContinuationJump() private method

private ContinuationJump ( NativeContinuation c, Interpreter current ) : System
c NativeContinuation
current Interpreter
return System
			internal ContinuationJump(NativeContinuation c, Interpreter.CallFrame current)
			{
				this.capturedFrame = (Interpreter.CallFrame)c.GetImplementation();
				if (this.capturedFrame == null || current == null)
				{
					// Continuation and current execution does not share
					// any frames if there is nothing to capture or
					// if there is no currently executed frames
					this.branchFrame = null;
				}
				else
				{
					// Search for branch frame where parent frame chains starting
					// from captured and current meet.
					Interpreter.CallFrame chain1 = this.capturedFrame;
					Interpreter.CallFrame chain2 = current;
					// First work parents of chain1 or chain2 until the same
					// frame depth.
					int diff = chain1.frameIndex - chain2.frameIndex;
					if (diff != 0)
					{
						if (diff < 0)
						{
							// swap to make sure that
							// chain1.frameIndex > chain2.frameIndex and diff > 0
							chain1 = current;
							chain2 = this.capturedFrame;
							diff = -diff;
						}
						do
						{
							chain1 = chain1.parentFrame;
						}
						while (--diff != 0);
						if (chain1.frameIndex != chain2.frameIndex)
						{
							Kit.CodeBug();
						}
					}
					// Now walk parents in parallel until a shared frame is found
					// or until the root is reached.
					while (chain1 != chain2 && chain1 != null)
					{
						chain1 = chain1.parentFrame;
						chain2 = chain2.parentFrame;
					}
					this.branchFrame = chain1;
					if (this.branchFrame != null && !this.branchFrame.frozen)
					{
						Kit.CodeBug();
					}
				}
			}
		}
Interpreter.ContinuationJump