forked from M-Labs/artiq
1
0
Fork 0

compiler.transforms.inferencer: accept and ignore @kernel decorator.

This commit is contained in:
whitequark 2015-08-07 07:54:35 +03:00
parent 7562d39750
commit 1a969aa9e4
3 changed files with 9 additions and 2 deletions

View File

@ -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")

View File

@ -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(),
}

View File

@ -887,10 +887,13 @@ class Inferencer(algorithm.Visitor):
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