Skip to content

Commit 1a969aa

Browse files
author
whitequark
committedAug 7, 2015
compiler.transforms.inferencer: accept and ignore @kernel decorator.
1 parent 7562d39 commit 1a969aa

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
 

Diff for: ‎artiq/compiler/builtins.py

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def fn_round():
146146
def fn_print():
147147
return types.TBuiltinFunction("print")
148148

149+
def fn_kernel():
150+
return types.TBuiltinFunction("kernel")
151+
149152
def fn_syscall():
150153
return types.TBuiltinFunction("syscall")
151154

Diff for: ‎artiq/compiler/prelude.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ def globals():
1919
"len": builtins.fn_len(),
2020
"round": builtins.fn_round(),
2121
"print": builtins.fn_print(),
22+
"kernel": builtins.fn_kernel(),
2223
"syscall": builtins.fn_syscall(),
2324
}

Diff for: ‎artiq/compiler/transforms/inferencer.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,13 @@ def visit_arguments(self, node):
887887
arg.loc, default.loc)
888888

889889
def visit_FunctionDefT(self, node):
890-
if any(node.decorator_list):
890+
for index, decorator in enumerate(node.decorator_list):
891+
if types.is_builtin(decorator.type, "kernel"):
892+
continue
893+
891894
diag = diagnostic.Diagnostic("error",
892895
"decorators are not supported", {},
893-
node.at_locs[0], [node.decorator_list[0].loc])
896+
node.at_locs[index], [decorator.loc])
894897
self.engine.process(diag)
895898
return
896899

0 commit comments

Comments
 (0)
Please sign in to comment.