Skip to content

Commit

Permalink
compiler.transforms.inferencer: accept and ignore @kernel decorator.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Aug 7, 2015
1 parent 7562d39 commit 1a969aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions artiq/compiler/builtins.py
Expand Up @@ -146,6 +146,9 @@ def fn_round():
def fn_print():
return types.TBuiltinFunction("print")

def fn_kernel():
return types.TBuiltinFunction("kernel")

def fn_syscall():
return types.TBuiltinFunction("syscall")

Expand Down
1 change: 1 addition & 0 deletions artiq/compiler/prelude.py
Expand Up @@ -19,5 +19,6 @@ def globals():
"len": builtins.fn_len(),
"round": builtins.fn_round(),
"print": builtins.fn_print(),
"kernel": builtins.fn_kernel(),
"syscall": builtins.fn_syscall(),
}
7 changes: 5 additions & 2 deletions artiq/compiler/transforms/inferencer.py
Expand Up @@ -887,10 +887,13 @@ def visit_arguments(self, node):
arg.loc, default.loc)

def visit_FunctionDefT(self, node):
if any(node.decorator_list):
for index, decorator in enumerate(node.decorator_list):
if types.is_builtin(decorator.type, "kernel"):
continue

diag = diagnostic.Diagnostic("error",
"decorators are not supported", {},
node.at_locs[0], [node.decorator_list[0].loc])
node.at_locs[index], [decorator.loc])
self.engine.process(diag)
return

Expand Down

0 comments on commit 1a969aa

Please sign in to comment.