forked from M-Labs/artiq
transforms/inline: remove _is_in_attr_list
This commit is contained in:
parent
1b81fc8a8f
commit
82da734e89
|
@ -13,12 +13,6 @@ from artiq.language import units
|
||||||
_UserVariable = namedtuple("_UserVariable", "name")
|
_UserVariable = namedtuple("_UserVariable", "name")
|
||||||
|
|
||||||
|
|
||||||
def _is_in_attr_list(obj, attr, al):
|
|
||||||
if not hasattr(obj, al):
|
|
||||||
return False
|
|
||||||
return attr in getattr(obj, al).split()
|
|
||||||
|
|
||||||
|
|
||||||
class _ReferenceManager:
|
class _ReferenceManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# (id(obj), func_name, local_name) or (id(obj), kernel_attr_name)
|
# (id(obj), func_name, local_name) or (id(obj), kernel_attr_name)
|
||||||
|
@ -66,7 +60,7 @@ class _ReferenceManager:
|
||||||
return getattr(builtins, ref.id)
|
return getattr(builtins, ref.id)
|
||||||
elif isinstance(ref, ast.Attribute):
|
elif isinstance(ref, ast.Attribute):
|
||||||
target = self.get(obj, func_name, ref.value)
|
target = self.get(obj, func_name, ref.value)
|
||||||
if _is_in_attr_list(target, ref.attr, "kernel_attr"):
|
if hasattr(target, "kernel_attr") and ref.attr in target.kernel_attr.split():
|
||||||
key = (id(target), ref.attr)
|
key = (id(target), ref.attr)
|
||||||
try:
|
try:
|
||||||
ival = self.to_inlined[key]
|
ival = self.to_inlined[key]
|
||||||
|
|
Loading…
Reference in New Issue