forked from VimPlug/jedi
keyword statement not includes globals
This commit is contained in:
@@ -563,16 +563,6 @@ class Parser(object):
|
||||
stmt.start_pos = s
|
||||
except AttributeError:
|
||||
debug.warning('return in non-function')
|
||||
# globals
|
||||
elif tok_str == 'global':
|
||||
stmt, tok = self._parse_statement(self._gen.current)
|
||||
if stmt:
|
||||
self._scope.add_statement(stmt)
|
||||
for t in stmt._token_list:
|
||||
if isinstance(t, pr.Name):
|
||||
# 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:
|
||||
@@ -580,9 +570,14 @@ class Parser(object):
|
||||
self._scope.asserts.append(stmt)
|
||||
elif tok_str in STATEMENT_KEYWORDS:
|
||||
stmt, _ = self._parse_statement()
|
||||
k = pr.KeywordStatement(tok_str, tok.start_pos,
|
||||
use_as_parent_scope, stmt)
|
||||
self._scope.add_statement(k)
|
||||
kw = pr.KeywordStatement(tok_str, tok.start_pos,
|
||||
use_as_parent_scope, stmt)
|
||||
self._scope.add_statement(kw)
|
||||
if stmt is not None and tok_str == 'global':
|
||||
for t in stmt._token_list:
|
||||
if isinstance(t, pr.Name):
|
||||
# Add the global to the top module, it counts there.
|
||||
self.module.add_global(t)
|
||||
# decorator
|
||||
elif tok_str == '@':
|
||||
stmt, tok = self._parse_statement()
|
||||
|
||||
Reference in New Issue
Block a user