summaryrefslogtreecommitdiff
path: root/coverage/parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-10-12 08:01:31 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-10-12 08:01:31 -0400
commite6ea0cbe7a9dbd4f2f8e6f853555dbd1505b0416 (patch)
tree5856b266f1af53bf0a44c35e2b45300f4ed4f0b2 /coverage/parser.py
parentca039838a5c2f98c4566c7796aa42f4561c8eac3 (diff)
downloadpython-coveragepy-git-e6ea0cbe7a9dbd4f2f8e6f853555dbd1505b0416.tar.gz
D'oh: I was finding jumpers to anonymous chunks wrongly, turns out there are lots of multi-jump anonymous chunks.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r--coverage/parser.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index e2864162..0747d4a5 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -248,7 +248,7 @@ class CodeParser:
line_jumps = [(self._line_for_byte(bytes_lines, b0), self._line_for_byte(bytes_lines, b1)) for b0, b1 in byte_jumps]
return byte_jumps, line_jumps
- _chunk_enders = set([opcode.opmap[name] for name in ['JUMP_ABSOLUTE', 'RETURN_VALUE']])
+ _chunk_enders = set([opcode.opmap[name] for name in ['JUMP_ABSOLUTE', 'JUMP_FORWARD', 'RETURN_VALUE']])
def _split_into_chunks(self, code):
class Chunk(object):
@@ -287,10 +287,13 @@ class CodeParser:
# the numbered chunks that jump to them.
for ch in chunks:
if not ch.line:
- jumpers = [c for c in chunks if ch.line in c.exits]
+ jumpers = [c for c in chunks if ch.byte in c.exits]
+ if len(jumpers) == 1:
+ ch.line = jumpers[0].line
if len(jumpers) > 1:
- warnings.append("Chunk at %d has %d jumpers" % (ch.byte, len(jumpers)))
-
+ warnings.append("Anon chunk at %d has %d jumpers" % (ch.byte, len(jumpers)))
+ #if len(ch.exits) > 1:
+ # warnings.append("Anon chunk at %d has %d exits" % (ch.byte, len(ch.exits)))
return warnings, chunks
def _all_chunks(self, code):