forked from M-Labs/artiq
1
0
Fork 0

transforms/inline: support skipping of attr init

This commit is contained in:
Sebastien Bourdeauducq 2015-01-29 23:48:03 +08:00
parent 7d6b93d8eb
commit c0c0137d9a
1 changed files with 3 additions and 0 deletions

View File

@ -433,6 +433,9 @@ def get_attr_init(attribute_namespace, loc_node):
for (_, attr), attr_info in attribute_namespace.items(): for (_, attr), attr_info in attribute_namespace.items():
if hasattr(attr_info.obj, attr): if hasattr(attr_info.obj, attr):
value = getattr(attr_info.obj, attr) value = getattr(attr_info.obj, attr)
if (hasattr(value, "kernel_attr_init")
and not value.kernel_attr_init):
continue
value = ast.copy_location(value_to_ast(value), loc_node) value = ast.copy_location(value_to_ast(value), loc_node)
target = ast.copy_location(ast.Name(attr_info.mangled_name, target = ast.copy_location(ast.Name(attr_info.mangled_name,
ast.Store()), ast.Store()),