Clean up with
This commit is contained in:
parent
b99460b632
commit
2ef9bc75d4
@ -1452,25 +1452,22 @@ class HyASTCompiler(object):
|
||||
raise HyTypeError(expr,
|
||||
"with expects a list, received `{0}'".format(
|
||||
type(args).__name__))
|
||||
if len(args) < 1:
|
||||
raise HyTypeError(expr, "with needs [[arg (expr)]] or [[(expr)]]]")
|
||||
|
||||
args.reverse()
|
||||
ctx = self.compile(args.pop(0))
|
||||
if len(args) not in (1, 2):
|
||||
raise HyTypeError(expr, "with needs [arg (expr)] or [(expr)]")
|
||||
|
||||
thing = None
|
||||
if args != []:
|
||||
if len(args) == 2:
|
||||
thing = self._storeize(args[0], self.compile(args.pop(0)))
|
||||
ctx = self.compile(args.pop(0))
|
||||
|
||||
body = self._compile_branch(expr)
|
||||
|
||||
# Store the result of the body in a tempvar
|
||||
var = self.get_anon_var()
|
||||
name = ast.Name(id=ast_str(var), arg=ast_str(var),
|
||||
ctx=ast.Store(),
|
||||
lineno=expr.start_line,
|
||||
col_offset=expr.start_column)
|
||||
|
||||
# Store the result of the body in a tempvar
|
||||
body += ast.Assign(targets=[name],
|
||||
value=body.force_expr,
|
||||
lineno=expr.start_line,
|
||||
|
Loading…
Reference in New Issue
Block a user