mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
changed the way how the dynamic param function searches it's parent scope, to enable smooth list comprehension following
This commit is contained in:
@@ -95,7 +95,7 @@ def search_params(evaluator, param):
|
|||||||
continue
|
continue
|
||||||
scopes = [scope]
|
scopes = [scope]
|
||||||
if first:
|
if first:
|
||||||
scopes = evaluator.eval_call_path(iter(first), scope, pos)
|
scopes = evaluator.eval_call_path(iter(first), c.parent, pos)
|
||||||
pos = None
|
pos = None
|
||||||
from jedi.evaluate import representation as er
|
from jedi.evaluate import representation as er
|
||||||
for scope in scopes:
|
for scope in scopes:
|
||||||
|
|||||||
@@ -50,7 +50,11 @@ class NameFinder(object):
|
|||||||
and isinstance(self.name_str.parent.parent, pr.Param)):
|
and isinstance(self.name_str.parent.parent, pr.Param)):
|
||||||
if not isinstance(self.name_str, (str, unicode)): # TODO Remove?
|
if not isinstance(self.name_str, (str, unicode)): # TODO Remove?
|
||||||
err_type = 'name-error' if search_global else 'attribute-error'
|
err_type = 'name-error' if search_global else 'attribute-error'
|
||||||
message = ('AttributeError: %s has no attribute %s'
|
if err_type == 'name-error':
|
||||||
|
message = ("NameError: name '%s' is not defined."
|
||||||
|
% self.name_str)
|
||||||
|
else:
|
||||||
|
message = ('AttributeError: %s has no attribute %s.'
|
||||||
% (self._last_filter_name_scope, self.name_str))
|
% (self._last_filter_name_scope, self.name_str))
|
||||||
analysis.add(self._evaluator, err_type, self.name_str, message,
|
analysis.add(self._evaluator, err_type, self.name_str, message,
|
||||||
payload=(self.scope, self.name_str))
|
payload=(self.scope, self.name_str))
|
||||||
|
|||||||
@@ -76,6 +76,12 @@ return_one(''.undefined_attribute)
|
|||||||
|
|
||||||
[r for r in [1, 2]]
|
[r for r in [1, 2]]
|
||||||
|
|
||||||
|
# some random error throw
|
||||||
|
class NotCalled():
|
||||||
|
def match_something(self, param):
|
||||||
|
seems_to_need_an_assignment = param
|
||||||
|
return [value.match_something() for value in []]
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# decorators
|
# decorators
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user