mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Remove node_is_object, not used anymore
This commit is contained in:
@@ -293,7 +293,6 @@ def _create(inference_state, access_handle, parent_context, *args):
|
||||
module_context.create_context(
|
||||
tree_node,
|
||||
node_is_value=True,
|
||||
node_is_object=True
|
||||
)._value
|
||||
# TODO private access!
|
||||
})
|
||||
|
||||
@@ -22,26 +22,11 @@ class AbstractContext(object):
|
||||
def get_root_context(self):
|
||||
return self._value.get_root_context()
|
||||
|
||||
def create_context(self, node, node_is_value=False, node_is_object=False):
|
||||
def create_context(self, node, node_is_value=False):
|
||||
from jedi.inference.value import ClassValue, FunctionValue, \
|
||||
AnonymousInstance, BoundMethod
|
||||
|
||||
def parent_scope(node):
|
||||
while True:
|
||||
node = node.parent
|
||||
|
||||
if parser_utils.is_scope(node):
|
||||
return node
|
||||
elif node.type in ('argument', 'testlist_comp'):
|
||||
if node.children[1].type in ('comp_for', 'sync_comp_for'):
|
||||
return node.children[1]
|
||||
elif node.type == 'dictorsetmaker':
|
||||
for n in node.children[1:4]:
|
||||
# In dictionaries it can be pretty much anything.
|
||||
if n.type in ('comp_for', 'sync_comp_for'):
|
||||
return n
|
||||
|
||||
def from_scope_node(scope_node, is_nested=True, node_is_object=False):
|
||||
def from_scope_node(scope_node, is_nested=True):
|
||||
if scope_node == base_node:
|
||||
return self
|
||||
|
||||
@@ -59,9 +44,6 @@ class AbstractContext(object):
|
||||
instance=instance,
|
||||
function=func
|
||||
)
|
||||
|
||||
if is_nested and not node_is_object:
|
||||
return func.get_function_execution()
|
||||
return func.as_context()
|
||||
elif scope_node.type == 'classdef':
|
||||
return ClassValue(self.inference_state, parent_context, scope_node).as_context()
|
||||
@@ -76,6 +58,21 @@ class AbstractContext(object):
|
||||
if node_is_value and parser_utils.is_scope(node):
|
||||
scope_node = node
|
||||
else:
|
||||
def parent_scope(node):
|
||||
while True:
|
||||
node = node.parent
|
||||
|
||||
if parser_utils.is_scope(node):
|
||||
return node
|
||||
elif node.type in ('argument', 'testlist_comp'):
|
||||
if node.children[1].type in ('comp_for', 'sync_comp_for'):
|
||||
return node.children[1]
|
||||
elif node.type == 'dictorsetmaker':
|
||||
for n in node.children[1:4]:
|
||||
# In dictionaries it can be pretty much anything.
|
||||
if n.type in ('comp_for', 'sync_comp_for'):
|
||||
return n
|
||||
|
||||
scope_node = parent_scope(node)
|
||||
if scope_node.type in ('funcdef', 'classdef'):
|
||||
colon = scope_node.children[scope_node.children.index(':')]
|
||||
@@ -83,7 +80,7 @@ class AbstractContext(object):
|
||||
parent = node.parent
|
||||
if not (parent.type == 'param' and parent.name == node):
|
||||
scope_node = parent_scope(scope_node)
|
||||
return from_scope_node(scope_node, is_nested=True, node_is_object=node_is_object)
|
||||
return from_scope_node(scope_node, is_nested=True)
|
||||
|
||||
def goto(self, name_or_str, position):
|
||||
from jedi.inference import finder
|
||||
|
||||
Reference in New Issue
Block a user