Updating yield.
This commit is contained in:
parent
454323ae04
commit
f295b10f52
@ -453,11 +453,14 @@ class HyASTCompiler(object):
|
||||
return ast.Pass(lineno=expr.start_line, col_offset=expr.start_column)
|
||||
|
||||
@builds("yield")
|
||||
@checkargs(1)
|
||||
@checkargs(max=1)
|
||||
def compile_yield_expression(self, expr):
|
||||
expr.pop(0)
|
||||
value = None
|
||||
if expr != []:
|
||||
value = self.compile(expr.pop(0))
|
||||
return ast.Yield(
|
||||
value=self.compile(expr.pop(0)),
|
||||
value=value,
|
||||
lineno=expr.start_line,
|
||||
col_offset=expr.start_column)
|
||||
|
||||
|
@ -210,7 +210,6 @@ def test_ast_good_yield():
|
||||
|
||||
def test_ast_bad_yield():
|
||||
"Make sure AST can't compile invalid yield"
|
||||
cant_compile("(yield)")
|
||||
cant_compile("(yield 1 2)")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user