mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make it possible to have a string_name attribute on instance params
This commit is contained in:
@@ -19,8 +19,10 @@ from jedi.parser_utils import get_parent_scope
|
||||
|
||||
|
||||
class InstanceExecutedParam(object):
|
||||
def __init__(self, instance):
|
||||
def __init__(self, instance, tree_param):
|
||||
self._instance = instance
|
||||
self._tree_param = tree_param
|
||||
self.string_name = self._tree_param.name.value
|
||||
|
||||
def infer(self):
|
||||
return ContextSet(self._instance)
|
||||
@@ -32,8 +34,11 @@ class AnonymousInstanceArguments(AnonymousArguments):
|
||||
|
||||
def get_executed_params(self, execution_context):
|
||||
from jedi.evaluate.dynamic import search_params
|
||||
self_param = InstanceExecutedParam(self._instance)
|
||||
tree_params = execution_context.tree_node.get_params()
|
||||
if not tree_params:
|
||||
return []
|
||||
|
||||
self_param = InstanceExecutedParam(self._instance, tree_params[0])
|
||||
if len(tree_params) == 1:
|
||||
# If the only param is self, we don't need to try to find
|
||||
# executions of this function, we have all the params already.
|
||||
|
||||
Reference in New Issue
Block a user