Microsoft.Scripting.Interpreter.InterpretedFrame.GroupStackFrames C# (CSharp) Method

GroupStackFrames() public static method

A single interpreted frame might be represented by multiple subsequent Interpreter.Run CLR frames. This method filters out the duplicate CLR frames.
public static GroupStackFrames ( IEnumerable stackTrace ) : IEnumerable
stackTrace IEnumerable
return IEnumerable
        public static IEnumerable<StackFrame> GroupStackFrames(IEnumerable<StackFrame> stackTrace) {
            bool inInterpretedFrame = false;
            foreach (StackFrame frame in stackTrace) {
                if (InterpretedFrame.IsInterpretedFrame(frame.GetMethod())) {
                    if (inInterpretedFrame) {
                        continue;
                    }
                    inInterpretedFrame = true;
                } else {
                    inInterpretedFrame = false;
                }
                yield return frame;
            }
        }