1
0
forked from VimPlug/jedi

KeywordStatements are working except for some of the old ones (global, assert, return, yield)

This commit is contained in:
Dave Halter
2014-03-04 17:20:29 +01:00
parent 53fd1f925a
commit f54344fd9e
2 changed files with 35 additions and 21 deletions

View File

@@ -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] \