1
0
forked from VimPlug/jedi

Fix issue with descriptors.

This commit is contained in:
Dave Halter
2014-09-24 16:52:44 +02:00
parent 19b32a3657
commit db31536d78
2 changed files with 9 additions and 4 deletions

View File

@@ -119,7 +119,7 @@ class NameFinder(object):
if check is flow_analysis.REACHABLE:
break
if names and self._is_name_break_scope(name, stmt):
if names and self._is_name_break_scope(stmt):
if self._does_scope_break_immediately(scope, name_list_scope):
break
else:
@@ -167,12 +167,12 @@ class NameFinder(object):
result = inst.execute_subscope_by_name('__getattribute__', [name])
return result
def _is_name_break_scope(self, name, stmt):
def _is_name_break_scope(self, stmt):
"""
Returns True except for nested imports and instance variables.
"""
if stmt.isinstance(pr.ExprStmt):
if isinstance(name, er.InstanceElement) and not name.is_class_var:
if isinstance(stmt, er.InstanceElement) and not stmt.is_class_var:
return False
elif isinstance(stmt, pr.Import) and stmt.is_nested():
return False

View File

@@ -682,7 +682,12 @@ class Flow(Scope):
def add_name_call(self, name, call):
"""Add a name to the names_dict."""
self.parent.add_name_call(name, call)
parent = self.parent
if isinstance(parent, Module):
# TODO this also looks like code smell. Look for opportunities to
# remove.
parent = self._sub_module
parent.add_name_call(name, call)
@property
def parent(self):