parent
066c9781c7
commit
0055f00a76
@ -1096,24 +1096,14 @@ class HyASTCompiler(object):
|
|||||||
def compile_kwapply_expression(self, expr):
|
def compile_kwapply_expression(self, expr):
|
||||||
expr.pop(0) # kwapply
|
expr.pop(0) # kwapply
|
||||||
call = self.compile(expr.pop(0))
|
call = self.compile(expr.pop(0))
|
||||||
kwargs = expr.pop(0)
|
kwargs = self.compile(expr.pop(0))
|
||||||
|
|
||||||
if type(call.expr) != ast.Call:
|
if type(call.expr) != ast.Call:
|
||||||
raise HyTypeError(expr, "kwapplying a non-call")
|
raise HyTypeError(expr, "kwapplying a non-call")
|
||||||
|
|
||||||
if type(kwargs) != HyDict:
|
call.expr.kwargs = kwargs.force_expr
|
||||||
raise TypeError("kwapplying with a non-dict")
|
|
||||||
|
|
||||||
keywords = []
|
return kwargs + call
|
||||||
ret = Result()
|
|
||||||
for x in kwargs:
|
|
||||||
ret += self.compile(kwargs[x])
|
|
||||||
keywords.append(ast.keyword(arg=ast_str(x),
|
|
||||||
value=ret.force_expr))
|
|
||||||
|
|
||||||
call.expr.keywords = keywords
|
|
||||||
|
|
||||||
return ret + call
|
|
||||||
|
|
||||||
@builds("not")
|
@builds("not")
|
||||||
@builds("~")
|
@builds("~")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user