mirror of
https://github.com/davidhalter/jedi.git
synced 2026-09-14 03:31:55 +08:00
_get_definition -> get_definition in parso.
This commit is contained in:
+4
-4
@@ -140,7 +140,7 @@ class BaseDefinition(object):
|
|||||||
resolve = False
|
resolve = False
|
||||||
if tree_name is not None:
|
if tree_name is not None:
|
||||||
# TODO move this to their respective names.
|
# TODO move this to their respective names.
|
||||||
definition = tree_name._get_definition()
|
definition = tree_name.get_definition()
|
||||||
if definition is not None and definition.type == 'import_from' and \
|
if definition is not None and definition.type == 'import_from' and \
|
||||||
tree_name.is_definition():
|
tree_name.is_definition():
|
||||||
resolve = True
|
resolve = True
|
||||||
@@ -547,7 +547,7 @@ class Definition(BaseDefinition):
|
|||||||
return typ + ' ' + code
|
return typ + ' ' + code
|
||||||
|
|
||||||
|
|
||||||
definition = tree_name._get_definition() or tree_name
|
definition = tree_name.get_definition() or tree_name
|
||||||
# Remove the prefix, because that's not what we want for get_code
|
# Remove the prefix, because that's not what we want for get_code
|
||||||
# here.
|
# here.
|
||||||
txt = definition.get_code(include_prefix=False)
|
txt = definition.get_code(include_prefix=False)
|
||||||
@@ -632,7 +632,7 @@ class CallSignature(Definition):
|
|||||||
if self.params:
|
if self.params:
|
||||||
param_name = self.params[-1]._name
|
param_name = self.params[-1]._name
|
||||||
if param_name.tree_name is not None:
|
if param_name.tree_name is not None:
|
||||||
if param_name.tree_name._get_definition().star_count == 2:
|
if param_name.tree_name.get_definition().star_count == 2:
|
||||||
return i
|
return i
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -641,7 +641,7 @@ class CallSignature(Definition):
|
|||||||
tree_name = param._name.tree_name
|
tree_name = param._name.tree_name
|
||||||
if tree_name is not None:
|
if tree_name is not None:
|
||||||
# *args case
|
# *args case
|
||||||
if tree_name._get_definition().star_count == 1:
|
if tree_name.get_definition().star_count == 1:
|
||||||
return i
|
return i
|
||||||
return None
|
return None
|
||||||
return self._index
|
return self._index
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ def resolve_potential_imports(evaluator, definitions):
|
|||||||
new = set()
|
new = set()
|
||||||
for d in definitions:
|
for d in definitions:
|
||||||
if isinstance(d, TreeNameDefinition):
|
if isinstance(d, TreeNameDefinition):
|
||||||
imp_or_stmt = d.tree_name._get_definition()
|
imp_or_stmt = d.tree_name.get_definition()
|
||||||
if isinstance(imp_or_stmt, tree.Import):
|
if isinstance(imp_or_stmt, tree.Import):
|
||||||
new |= resolve_potential_imports(
|
new |= resolve_potential_imports(
|
||||||
evaluator,
|
evaluator,
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ class Evaluator(object):
|
|||||||
return types
|
return types
|
||||||
|
|
||||||
def goto_definitions(self, context, name):
|
def goto_definitions(self, context, name):
|
||||||
def_ = name._get_definition(import_name_always=True)
|
def_ = name.get_definition(import_name_always=True)
|
||||||
if def_ is not None:
|
if def_ is not None:
|
||||||
type_ = def_.type
|
type_ = def_.type
|
||||||
if type_ == 'classdef':
|
if type_ == 'classdef':
|
||||||
@@ -468,7 +468,7 @@ class Evaluator(object):
|
|||||||
return helpers.evaluate_call_of_leaf(context, name)
|
return helpers.evaluate_call_of_leaf(context, name)
|
||||||
|
|
||||||
def goto(self, context, name):
|
def goto(self, context, name):
|
||||||
definition = name._get_definition(import_name_always=True)
|
definition = name.get_definition(import_name_always=True)
|
||||||
if definition is not None:
|
if definition is not None:
|
||||||
type_ = definition.type
|
type_ = definition.type
|
||||||
if type_ == 'expr_stmt':
|
if type_ == 'expr_stmt':
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class TreeNameDefinition(AbstractTreeName):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def api_type(self):
|
def api_type(self):
|
||||||
definition = self.tree_name._get_definition()
|
definition = self.tree_name.get_definition()
|
||||||
if definition is None:
|
if definition is None:
|
||||||
definition = self.tree_name.parent
|
definition = self.tree_name.parent
|
||||||
if definition.type == 'dotted_as_name':
|
if definition.type == 'dotted_as_name':
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class NameFinder(object):
|
|||||||
|
|
||||||
def _name_to_types(evaluator, context, tree_name):
|
def _name_to_types(evaluator, context, tree_name):
|
||||||
types = []
|
types = []
|
||||||
node = tree_name._get_definition()
|
node = tree_name.get_definition()
|
||||||
if node is None:
|
if node is None:
|
||||||
node = tree_name.parent
|
node = tree_name.parent
|
||||||
if node.type == 'global_stmt':
|
if node.type == 'global_stmt':
|
||||||
|
|||||||
Reference in New Issue
Block a user