forked from M-Labs/artiq
compiler.transforms.inferencer: accept and ignore @kernel decorator.
This commit is contained in:
parent
7562d39750
commit
1a969aa9e4
@ -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")
|
||||
|
||||
|
@ -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(),
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user