Preparation for a parser refactoring.

This commit is contained in:
Dave Halter
2014-10-16 11:45:25 +02:00
parent 887949e23f
commit 01ce93cb5c

View File

@@ -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.