mirror of https://github.com/m-labs/artiq.git
compiler: supports kernel decorators with path
This commit is contained in:
parent
6fb31a7abb
commit
822e8565f7
|
@ -6,6 +6,7 @@ from collections import OrderedDict
|
||||||
from pythonparser import algorithm, diagnostic, ast
|
from pythonparser import algorithm, diagnostic, ast
|
||||||
from .. import asttyped, types, builtins
|
from .. import asttyped, types, builtins
|
||||||
from .typedtree_printer import TypedtreePrinter
|
from .typedtree_printer import TypedtreePrinter
|
||||||
|
from artiq.experiment import kernel
|
||||||
|
|
||||||
|
|
||||||
def is_nested_empty_list(node):
|
def is_nested_empty_list(node):
|
||||||
|
@ -1662,7 +1663,14 @@ class Inferencer(algorithm.Visitor):
|
||||||
|
|
||||||
def visit_FunctionDefT(self, node):
|
def visit_FunctionDefT(self, node):
|
||||||
for index, decorator in enumerate(node.decorator_list):
|
for index, decorator in enumerate(node.decorator_list):
|
||||||
if types.is_builtin(decorator.type, "kernel") or \
|
def eval_attr(attr):
|
||||||
|
if isinstance(attr.value, asttyped.QuoteT):
|
||||||
|
return getattr(attr.value.value, attr.attr)
|
||||||
|
return getattr(eval_attr(attr.value), attr.attr)
|
||||||
|
if isinstance(decorator, asttyped.AttributeT):
|
||||||
|
decorator = eval_attr(decorator)
|
||||||
|
if id(decorator) == id(kernel) or \
|
||||||
|
types.is_builtin(decorator.type, "kernel") or \
|
||||||
isinstance(decorator, asttyped.CallT) and \
|
isinstance(decorator, asttyped.CallT) and \
|
||||||
types.is_builtin(decorator.func.type, "kernel"):
|
types.is_builtin(decorator.func.type, "kernel"):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue