KeywordStatements are working except for some of the old ones (global, assert, return, yield)
This commit is contained in:
1 parent
53fd1f925a
commit
f54344fd9e
2 files changed
+35
-21
No files matched your search
@@ -573,6 +573,11 @@ class Parser(object):
|
||||
# add the global to the top, because there it is
|
||||
# important.
|
||||
self.module.add_global(t)
|
||||
elif tok_str == 'assert':
|
||||
stmt, tok = self._parse_statement()
|
||||
if stmt is not None:
|
||||
stmt.parent = use_as_parent_scope
|
||||
self._scope.asserts.append(stmt)
|
||||
elif tok_str in STATEMENT_KEYWORDS:
|
||||
stmt, _ = self._parse_statement()
|
||||
k = pr.KeywordStatement(tok_str, tok.start_pos,
|
||||
@@ -585,11 +590,6 @@ class Parser(object):
|
||||
self._decorators.append(stmt)
|
||||
elif tok_str == 'pass':
|
||||
continue
|
||||
elif tok_str == 'assert':
|
||||
stmt, tok = self._parse_statement()
|
||||
if stmt is not None:
|
||||
stmt.parent = use_as_parent_scope
|
||||
self._scope.asserts.append(stmt)
|
||||
# default
|
||||
elif token_type in [tokenize.NAME, tokenize.STRING,
|
||||
tokenize.NUMBER] \
|
||||
|
||||
Reference in new issue
Block a user