mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-20 04:21:13 +08:00
Preparation for a parser refactoring.
This commit is contained in:
@@ -385,12 +385,15 @@ class Scope(Simple, DocstringMixin):
|
|||||||
self.imports = []
|
self.imports = []
|
||||||
self._doc_token = None
|
self._doc_token = None
|
||||||
self.asserts = []
|
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._names_dict = defaultdict(_return_empty_list)
|
||||||
self.is_generator = False
|
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
|
@property
|
||||||
def statements(self):
|
def statements(self):
|
||||||
return [c for c in self.children if isinstance(c, ExprStmt)]
|
return [c for c in self.children if isinstance(c, ExprStmt)]
|
||||||
@@ -1107,6 +1110,8 @@ class Statement(Simple, DocstringMixin):
|
|||||||
|
|
||||||
class ExprStmt(Statement):
|
class ExprStmt(Statement):
|
||||||
"""
|
"""
|
||||||
|
TODO rename to SmallStmt
|
||||||
|
|
||||||
This class exists temporarily, to be able to distinguish real statements
|
This class exists temporarily, to be able to distinguish real statements
|
||||||
(``small_stmt`` in Python grammar) from the so called ``test`` parts, that
|
(``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.
|
may be used to defined part of an array, but are never a whole statement.
|
||||||
|
|||||||
Reference in New Issue
Block a user