From 24682d3cecd834229fde6e4e09d4380359e3a49a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 16 Jan 2016 11:23:57 -0500 Subject: Stop treating yield-from and await as function returns --- coverage/parser.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'coverage/parser.py') diff --git a/coverage/parser.py b/coverage/parser.py index f0bfe614..07cb75d2 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -404,15 +404,6 @@ class AstArcAnalyzer(object): Return a set of line numbers, exits from this node to the next. """ - # Yield-froms and awaits can appear anywhere. - # TODO: this is probably over-doing it, and too expensive. Can we - # instrument the ast walking to see how many nodes we are revisiting? - if isinstance(node, ast.stmt): - for _, value in ast.iter_fields(node): - if isinstance(value, ast.expr) and self.contains_return_expression(value): - self.process_return_exits([self.line_for_node(node)]) - break - node_name = node.__class__.__name__ handler = getattr(self, "_handle__" + node_name, None) if handler is not None: @@ -759,14 +750,6 @@ class AstArcAnalyzer(object): self.arcs.add((-1, start)) self.arcs.add((start, -start)) - def contains_return_expression(self, node): - """Is there a yield-from or await in `node` someplace?""" - for child in ast.walk(node): - if child.__class__.__name__ in ["YieldFrom", "Await"]: - return True - - return False - class ByteParser(object): """Parse bytecode to understand the structure of code.""" -- cgit v1.2.1