forked from VimPlug/jedi
A simple yield should not cause an error, fixes #1117
This commit is contained in:
@@ -205,9 +205,13 @@ def eval_atom(context, atom):
|
|||||||
# For False/True/None
|
# For False/True/None
|
||||||
if atom.value in ('False', 'True', 'None'):
|
if atom.value in ('False', 'True', 'None'):
|
||||||
return ContextSet(compiled.builtin_from_name(context.evaluator, atom.value))
|
return ContextSet(compiled.builtin_from_name(context.evaluator, atom.value))
|
||||||
if atom.value == 'print':
|
elif atom.value == 'print':
|
||||||
# print e.g. could be evaluated like this in Python 2.7
|
# print e.g. could be evaluated like this in Python 2.7
|
||||||
return NO_CONTEXTS
|
return NO_CONTEXTS
|
||||||
|
elif atom.value == 'yield':
|
||||||
|
# Contrary to yield from, yield can just appear alone to return a
|
||||||
|
# value when used with `.send()`.
|
||||||
|
return NO_CONTEXTS
|
||||||
assert False, 'Cannot evaluate the keyword %s' % atom
|
assert False, 'Cannot evaluate the keyword %s' % atom
|
||||||
|
|
||||||
elif isinstance(atom, tree.Literal):
|
elif isinstance(atom, tree.Literal):
|
||||||
|
|||||||
@@ -208,6 +208,14 @@ def x():
|
|||||||
#? int()
|
#? int()
|
||||||
next(x())
|
next(x())
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# statements
|
||||||
|
# -----------------
|
||||||
|
def x():
|
||||||
|
foo = yield
|
||||||
|
#?
|
||||||
|
foo
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# yield from
|
# yield from
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user