1. Pypy
  2. Untitled project
  3. pypy

Commits

Maciej Fijalkowski  committed ee9892a

a test and a fix

  • Participants
  • Parent commits 9d14d0a
  • Branches default

Comments (0)

Files changed (2)

File pypy/tool/jitlogparser/parser.py

View file
             if not stack:
                 stack.append([])
             else:
-                if bc.inline_level is not None and bc.inline_level + 1 != len(stack):
-                    if bc.inline_level < len(stack):
-                        last = stack.pop()
-                        stack[-1].append(cls(last, getpath(stack), storage))
+                if bc.inline_level is not None:
+                    if bc.inline_level == len(stack) - 1:
+                        pass
+                    elif bc.inline_level > len(stack) - 1:
+                        stack.append([])
                     else:
-                        stack.append([])
+                        while bc.inline_level + 1 < len(stack):
+                            last = stack.pop()
+                            stack[-1].append(cls(last, getpath(stack), storage))
             stack[-1].append(bc)
 
         so_far = []

File pypy/tool/jitlogparser/test/test_parser.py

View file
     f = Function.from_operations(loop.operations, LoopStorage())
     assert f.chunks[-1].filename == 'x.py'
     assert f.filename is None
+
+def test_parse_2_levels_up():
+    loop = parse("""
+    []
+    debug_merge_point(0, 0, 'one')
+    debug_merge_point(1, 0, 'two')
+    debug_merge_point(2, 0, 'three')
+    debug_merge_point(0, 0, 'one')    
+    """)
+    f = Function.from_operations(loop.operations, LoopStorage())
+    assert len(f.chunks) == 3