forked from VimPlug/jedi
create_value can deal with modules now
This commit is contained in:
@@ -289,9 +289,6 @@ def _create(inference_state, access_handle, parent_context, *args):
|
||||
return ValueSet({compiled_object})
|
||||
module_context = parent_context.get_root_context()
|
||||
|
||||
if tree_node is module_node:
|
||||
tree_values = ValueSet({module_context.get_value()})
|
||||
else:
|
||||
tree_values = ValueSet({module_context.create_value(tree_node)})
|
||||
if tree_node.type == 'classdef':
|
||||
if not access_handle.is_class():
|
||||
|
||||
@@ -25,6 +25,10 @@ class AbstractContext(object):
|
||||
def create_value(self, node):
|
||||
from jedi.inference import value
|
||||
|
||||
if node == self.tree_node:
|
||||
assert self.is_module()
|
||||
return self.get_value()
|
||||
|
||||
parent_context = self.create_context(node)
|
||||
|
||||
if node.type in ('funcdef', 'lambdef'):
|
||||
@@ -56,7 +60,7 @@ class AbstractContext(object):
|
||||
if node.start_pos >= scope_node.children[-1].start_pos:
|
||||
return parent_context
|
||||
return CompForContext(parent_context, scope_node)
|
||||
raise Exception("There's a scope that was not managed.")
|
||||
raise Exception("There's a scope that was not managed: %s" % scope_node)
|
||||
|
||||
def parent_scope(node):
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user