diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index 619067e1..da62bd6a 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -1063,13 +1063,20 @@ class KeywordStatement(BaseNode): """ __slots__ = () + @property + def type(self): + """ + Keyword statements start with the keyword and end with `_stmt`. You can + crosscheck this with the Python grammar. + """ + return '%s_stmt' % self.keyword + @property def keyword(self): return self.children[0].value class AssertStmt(KeywordStatement): - type = 'assert_stmt' __slots__ = () def assertion(self): @@ -1077,7 +1084,6 @@ class AssertStmt(KeywordStatement): class GlobalStmt(KeywordStatement): - type = 'global_stmt' __slots__ = () def get_defined_names(self): @@ -1088,14 +1094,15 @@ class GlobalStmt(KeywordStatement): class ReturnStmt(KeywordStatement): - type = 'return_stmt' __slots__ = () class YieldExpr(BaseNode): - type = 'yield_expr' __slots__ = () + def type(self): + return 'yield_expr' + def _defined_names(current): """