diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-03-02 07:05:27 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-03-02 07:05:27 -0500 |
commit | 292becfc6657b0346b190a6489397e7fb6407cd3 (patch) | |
tree | 274c57bcab791c84cf185d59bc680ee902143e8f /coverage/parser.py | |
parent | 6d92b24be8a111f141dac958d821ebac75193781 (diff) | |
download | python-coveragepy-git-292becfc6657b0346b190a6489397e7fb6407cd3.tar.gz |
Entry arcs now use the negative first line of the code object instead of -1.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index f34a26fb..f4dd02d4 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -908,18 +908,18 @@ class AstArcAnalyzer(object): def _code_object__Module(self, node): start = self.line_for_node(node) if node.body: - exits = self.add_body_arcs(node.body, from_start=ArcStart(-1)) + exits = self.add_body_arcs(node.body, from_start=ArcStart(-start)) for xit in exits: self.add_arc(xit.lineno, -start, xit.cause, "didn't exit the module") else: # Empty module. - self.add_arc(-1, start) - self.add_arc(start, -1) + self.add_arc(-start, start) + self.add_arc(start, -start) def _code_object__FunctionDef(self, node): start = self.line_for_node(node) self.block_stack.append(FunctionBlock(start=start, name=node.name)) - exits = self.add_body_arcs(node.body, from_start=ArcStart(-1)) + exits = self.add_body_arcs(node.body, from_start=ArcStart(-start)) self.process_return_exits(exits) self.block_stack.pop() @@ -927,7 +927,7 @@ class AstArcAnalyzer(object): def _code_object__ClassDef(self, node): start = self.line_for_node(node) - self.add_arc(-1, start) + self.add_arc(-start, start) exits = self.add_body_arcs(node.body, from_start=ArcStart(start)) for xit in exits: self.add_arc( @@ -939,7 +939,7 @@ class AstArcAnalyzer(object): """A function to make methods for online callable _code_object__ methods.""" def _code_object__oneline_callable(self, node): start = self.line_for_node(node) - self.add_arc(-1, start) + self.add_arc(-start, start) self.add_arc( start, -start, None, "didn't run the {0} on line {1}".format(noun, start), |