mirror of https://github.com/m-labs/artiq.git
transforms/inline: add sequential block when inlining function
This commit is contained in:
parent
e6530075d9
commit
5144da3f9a
|
@ -164,7 +164,12 @@ class _ReferenceReplacer(ast.NodeTransformer):
|
||||||
args = [func.__self__] + new_args
|
args = [func.__self__] + new_args
|
||||||
inlined, _ = inline(self.core, func.k_function_info.k_function,
|
inlined, _ = inline(self.core, func.k_function_info.k_function,
|
||||||
args, dict(), self.rm)
|
args, dict(), self.rm)
|
||||||
return inlined.body
|
r = ast.With(
|
||||||
|
items=[ast.withitem(context_expr=ast.Name(id="sequential",
|
||||||
|
ctx=ast.Load()),
|
||||||
|
optional_vars=None)],
|
||||||
|
body=inlined.body)
|
||||||
|
return ast.copy_location(r, node)
|
||||||
else:
|
else:
|
||||||
args = [ast.Str("rpc"), value_to_ast(self.rm.rpc_map[func])]
|
args = [ast.Str("rpc"), value_to_ast(self.rm.rpc_map[func])]
|
||||||
args += new_args
|
args += new_args
|
||||||
|
@ -176,7 +181,7 @@ class _ReferenceReplacer(ast.NodeTransformer):
|
||||||
def visit_Expr(self, node):
|
def visit_Expr(self, node):
|
||||||
if isinstance(node.value, ast.Call):
|
if isinstance(node.value, ast.Call):
|
||||||
r = self.visit_Call(node.value)
|
r = self.visit_Call(node.value)
|
||||||
if isinstance(r, list):
|
if isinstance(r, ast.With):
|
||||||
return r
|
return r
|
||||||
else:
|
else:
|
||||||
node.value = r
|
node.value = r
|
||||||
|
|
Loading…
Reference in New Issue