mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
fix lambda issues
This commit is contained in:
@@ -9,12 +9,6 @@ class Status(object):
|
|||||||
self._name = name
|
self._name = name
|
||||||
Status.lookup_table[value] = self
|
Status.lookup_table[value] = self
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
return self._value == other.value
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
def __and__(self, other):
|
def __and__(self, other):
|
||||||
if UNSURE in (self, other):
|
if UNSURE in (self, other):
|
||||||
return other
|
return other
|
||||||
|
|||||||
@@ -476,13 +476,17 @@ class FunctionExecution(Executed):
|
|||||||
|
|
||||||
types = list(docstrings.find_return_types(self._evaluator, func))
|
types = list(docstrings.find_return_types(self._evaluator, func))
|
||||||
for r in self.returns:
|
for r in self.returns:
|
||||||
# r is a KeywordStatement
|
if isinstance(r, pr.KeywordStatement):
|
||||||
if r.stmt is None:
|
stmt = r.stmt
|
||||||
|
else:
|
||||||
|
stmt = r # Lambdas
|
||||||
|
|
||||||
|
if stmt is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
check = flow_analysis.break_check(self._evaluator, self, r.parent)
|
check = flow_analysis.break_check(self._evaluator, self, r.parent)
|
||||||
if check is not flow_analysis.UNREACHABLE:
|
if check is not flow_analysis.UNREACHABLE:
|
||||||
types += self._evaluator.eval_statement(r.stmt)
|
types += self._evaluator.eval_statement(stmt)
|
||||||
if check is flow_analysis.REACHABLE:
|
if check is flow_analysis.REACHABLE:
|
||||||
break
|
break
|
||||||
return types
|
return types
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ from jedi import cache
|
|||||||
from jedi.parser import tokenize
|
from jedi.parser import tokenize
|
||||||
|
|
||||||
|
|
||||||
SCOPE_CONTENTS = 'asserts', 'subscopes', 'imports', 'statements', 'returns'
|
SCOPE_CONTENTS = 'asserts', 'subscopes', 'imports', 'statements'
|
||||||
|
|
||||||
|
|
||||||
def filter_after_position(names, position):
|
def filter_after_position(names, position):
|
||||||
@@ -1105,6 +1105,7 @@ class Statement(Simple, DocstringMixin):
|
|||||||
ret, tok = parse_stmt(token_iterator)
|
ret, tok = parse_stmt(token_iterator)
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
ret.parent = lambd
|
ret.parent = lambd
|
||||||
|
lambd.statements.append(ret)
|
||||||
lambd.returns.append(ret)
|
lambd.returns.append(ret)
|
||||||
lambd.end_pos = self.end_pos
|
lambd.end_pos = self.end_pos
|
||||||
return lambd, tok
|
return lambd, tok
|
||||||
|
|||||||
@@ -96,10 +96,12 @@ def other(a):
|
|||||||
return recursion2(a)
|
return recursion2(a)
|
||||||
|
|
||||||
def recursion2(a):
|
def recursion2(a):
|
||||||
if a:
|
if random.choice([0, 1]):
|
||||||
return other(a)
|
return other(a)
|
||||||
else:
|
else:
|
||||||
|
if random.choice([0, 1]):
|
||||||
return recursion2("")
|
return recursion2("")
|
||||||
|
else:
|
||||||
return a
|
return a
|
||||||
|
|
||||||
#? int() str()
|
#? int() str()
|
||||||
|
|||||||
Reference in New Issue
Block a user