Microsoft.Scripting.Debugging.DebugFrame.RemapToGenerator C# (CSharp) Method

RemapToGenerator() private method

Remaps the frame's state to use the generator for execution.
private RemapToGenerator ( int version ) : void
version int Int32.MaxValue to map to latest version
return void
        internal void RemapToGenerator(int version) {
            Debug.Assert(_generator == null || _funcInfo.Version != version);

            // Try to find the target FunctionInfo for the specified version
            FunctionInfo targetFuncInfo = GetFunctionInfo(version);
            if (targetFuncInfo == null) {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorStrings.InvalidFunctionVersion, version));
            }

            // Create the new generator
            CreateGenerator(targetFuncInfo);

            // Run to the first yield point
            ((IEnumerator)_generator).MoveNext();
        }

Usage Example

Example #1
0
 internal DebugGenerator(DebugFrame frame)
 {
     _frame = frame;
     _frame.RemapToGenerator(frame.FunctionInfo.Version);
 }