From 5144da3f9a5467b8d3d1db15f6d5d7a9e7f026df Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 9 Sep 2014 22:01:28 +0800 Subject: [PATCH] transforms/inline: add sequential block when inlining function --- artiq/transforms/inline.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/artiq/transforms/inline.py b/artiq/transforms/inline.py index bf811af5a..b3f56a7b6 100644 --- a/artiq/transforms/inline.py +++ b/artiq/transforms/inline.py @@ -164,7 +164,12 @@ class _ReferenceReplacer(ast.NodeTransformer): args = [func.__self__] + new_args inlined, _ = inline(self.core, func.k_function_info.k_function, 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: args = [ast.Str("rpc"), value_to_ast(self.rm.rpc_map[func])] args += new_args @@ -176,7 +181,7 @@ class _ReferenceReplacer(ast.NodeTransformer): def visit_Expr(self, node): if isinstance(node.value, ast.Call): r = self.visit_Call(node.value) - if isinstance(r, list): + if isinstance(r, ast.With): return r else: node.value = r