mirror of
https://github.com/davidhalter/jedi.git
synced 2026-11-16 23:30:42 +08:00
moved global variables handling
This commit is contained in:
1 parent
2322edff8f
commit
5f8f1e170b
1 file changed
+8
-9
@@ -148,9 +148,10 @@ class NameFinder(object):
|
||||
types = []
|
||||
# Add isinstance and other if/assert knowledge.
|
||||
flow_scope = self.scope
|
||||
evaluator = self._evaluator
|
||||
while flow_scope:
|
||||
# TODO check if result is in scope -> no evaluation necessary
|
||||
n = check_flow_information(self._evaluator, flow_scope,
|
||||
n = check_flow_information(evaluator, flow_scope,
|
||||
self.name_str, self.position)
|
||||
if n:
|
||||
return n
|
||||
@@ -163,12 +164,16 @@ class NameFinder(object):
|
||||
elif isinstance(typ, pr.Param):
|
||||
types += self._eval_param(typ)
|
||||
elif typ.isinstance(pr.Statement):
|
||||
if typ.is_global():
|
||||
# global keyword handling.
|
||||
types += evaluator.find_types(typ.parent.parent, str(name))
|
||||
else:
|
||||
types += self._remove_statements(typ)
|
||||
else:
|
||||
if isinstance(typ, pr.Class):
|
||||
typ = er.Class(self._evaluator, typ)
|
||||
typ = er.Class(evaluator, typ)
|
||||
elif isinstance(typ, pr.Function):
|
||||
typ = er.Function(self._evaluator, typ)
|
||||
typ = er.Function(evaluator, typ)
|
||||
if typ.isinstance(er.Function) and resolve_decorator:
|
||||
typ = typ.get_decorated_func()
|
||||
types.append(typ)
|
||||
@@ -183,12 +188,6 @@ class NameFinder(object):
|
||||
"""
|
||||
evaluator = self._evaluator
|
||||
types = []
|
||||
if stmt.is_global():
|
||||
# global keyword handling.
|
||||
for token_name in stmt._token_list:
|
||||
if isinstance(token_name, pr.Name):
|
||||
return evaluator.find_types(stmt.parent.parent, str(token_name))
|
||||
else:
|
||||
# Remove the statement docstr stuff for now, that has to be
|
||||
# implemented with the evaluator class.
|
||||
#if stmt.docstr:
|
||||
|
||||
Reference in new issue
Block a user