From 01ce93cb5c2e61ca474b62da4572c4fa6001bce3 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 16 Oct 2014 11:45:25 +0200 Subject: [PATCH] Preparation for a parser refactoring. --- jedi/parser/representation.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index c91540a2..b1e9f49c 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -385,12 +385,15 @@ class Scope(Simple, DocstringMixin): self.imports = [] self._doc_token = None self.asserts = [] - # Needed here for fast_parser, because the fast_parser splits and - # returns will be in "normal" modules. - self.returns = [] self._names_dict = defaultdict(_return_empty_list) self.is_generator = False + @property + def returns(self): + # Needed here for fast_parser, because the fast_parser splits and + # returns will be in "normal" modules. + return [c for c in self.children if isinstance(c, ExprStmt)] + @property def statements(self): return [c for c in self.children if isinstance(c, ExprStmt)] @@ -1107,6 +1110,8 @@ class Statement(Simple, DocstringMixin): class ExprStmt(Statement): """ + TODO rename to SmallStmt + This class exists temporarily, to be able to distinguish real statements (``small_stmt`` in Python grammar) from the so called ``test`` parts, that may be used to defined part of an array, but are never a whole statement.