mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Even params should be NameParts as a Definition input.
This commit is contained in:
@@ -159,7 +159,7 @@ class Script(object):
|
||||
if not dot:
|
||||
# add named params
|
||||
for call_sig in self.call_signatures():
|
||||
# allow protected access, because it's a public API.
|
||||
# Allow protected access, because it's a public API.
|
||||
module = call_sig._definition.get_parent_until()
|
||||
# Compiled modules typically don't allow keyword arguments.
|
||||
if not isinstance(module, compiled.CompiledObject):
|
||||
@@ -167,8 +167,8 @@ class Script(object):
|
||||
# Allow access on _definition here, because it's a
|
||||
# public API and we don't want to make the internal
|
||||
# Name object public.
|
||||
if p._definition.stars == 0: # no *args/**kwargs
|
||||
completions.append((p._definition.get_name(), p))
|
||||
if p._definition.get_definition().stars == 0: # no *args/**kwargs
|
||||
completions.append((p._definition.parent, p))
|
||||
|
||||
if not path and not isinstance(user_stmt, pr.Import):
|
||||
# add keywords
|
||||
|
||||
@@ -385,7 +385,7 @@ class BaseDefinition(object):
|
||||
params = sub.params[1:] # ignore self
|
||||
except KeyError:
|
||||
return []
|
||||
return [_Param(self._evaluator, p) for p in params]
|
||||
return [_Param(self._evaluator, p.get_name().names[-1]) for p in params]
|
||||
|
||||
def parent(self):
|
||||
if isinstance(self._definition, compiled.CompiledObject):
|
||||
@@ -575,6 +575,8 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
||||
"""
|
||||
def __init__(self, evaluator, definition):
|
||||
super(Definition, self).__init__(evaluator, definition, definition.start_pos)
|
||||
if not isinstance(definition, pr.NamePart):
|
||||
raise NotImplementedError(definition)
|
||||
|
||||
@property
|
||||
@underscore_memoization
|
||||
|
||||
Reference in New Issue
Block a user