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