def _inline(node, gen_sym, return_name, constants):
"""
Return a list of nodes, representing inlined function call.
"""
fn = constants[node.func.id]
fn_ast = Function.from_object(fn).tree
gen_sym, new_fn_ast = mangle(gen_sym, fn_ast)
parameter_assignments = _build_parameter_assignments(node, new_fn_ast)
body_nodes = new_fn_ast.body
gen_sym, inlined_body, new_bindings = _wrap_in_loop(gen_sym, body_nodes, return_name)
constants = dict(constants)
constants.update(new_bindings)
return parameter_assignments + inlined_body, gen_sym, constants
评论列表
文章目录