mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Fix a decorator goto issue.
This commit is contained in:
@@ -302,12 +302,14 @@ class Evaluator(object):
|
|||||||
if trailer.type == 'arglist':
|
if trailer.type == 'arglist':
|
||||||
trailer = trailer.parent
|
trailer = trailer.parent
|
||||||
if trailer.type != 'classdef':
|
if trailer.type != 'classdef':
|
||||||
for i, t in enumerate(trailer.parent.children):
|
if trailer.type == 'decorator':
|
||||||
if t == trailer:
|
types = self.eval_element(trailer.children[1])
|
||||||
to_evaluate = trailer.parent.children[:i]
|
else:
|
||||||
types = self.eval_element(to_evaluate[0])
|
i = trailer.parent.children.index(trailer)
|
||||||
for trailer in to_evaluate[1:]:
|
to_evaluate = trailer.parent.children[:i]
|
||||||
types = self.eval_trailer(types, trailer)
|
types = self.eval_element(to_evaluate[0])
|
||||||
|
for trailer in to_evaluate[1:]:
|
||||||
|
types = self.eval_trailer(types, trailer)
|
||||||
param_names = []
|
param_names = []
|
||||||
for typ in types:
|
for typ in types:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -504,7 +504,6 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
if not self.is_decorated:
|
if not self.is_decorated:
|
||||||
for dec in reversed(decorators):
|
for dec in reversed(decorators):
|
||||||
debug.dbg('decorator: %s %s', dec, f)
|
debug.dbg('decorator: %s %s', dec, f)
|
||||||
dec.children
|
|
||||||
dec_results = self._evaluator.eval_element(dec.children[1])
|
dec_results = self._evaluator.eval_element(dec.children[1])
|
||||||
trailer = dec.children[2:-1]
|
trailer = dec.children[2:-1]
|
||||||
if trailer:
|
if trailer:
|
||||||
|
|||||||
@@ -191,3 +191,14 @@ for key, value in [(1,2)]:
|
|||||||
for i in []:
|
for i in []:
|
||||||
#! ['for i in []: i']
|
#! ['for i in []: i']
|
||||||
i
|
i
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# decorator
|
||||||
|
# -----------------
|
||||||
|
def dec(dec_param=3):
|
||||||
|
pass
|
||||||
|
|
||||||
|
#! 8 ['dec_param=3']
|
||||||
|
@dec(dec_param=5)
|
||||||
|
def y():
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user