提交 49ad2356 authored 作者: Frederic Bastien's avatar Frederic Bastien

Add var.tag.{removed,imported}_by during compilation

上级 0cf0187d
...@@ -328,6 +328,9 @@ class FunctionGraph(utils.object2): ...@@ -328,6 +328,9 @@ class FunctionGraph(utils.object2):
if output.clients or output in self.outputs] if output.clients or output in self.outputs]
# If the apply node is not used and is not an output # If the apply node is not used and is not an output
if not used_or_output: if not used_or_output:
if not hasattr(apply_node.tag, 'removed_by'):
apply_node.tag.removed_by = []
apply_node.tag.removed_by.append(reason)
self.apply_nodes.remove(apply_node) self.apply_nodes.remove(apply_node)
self.variables.difference_update(apply_node.outputs) self.variables.difference_update(apply_node.outputs)
self.execute_callbacks('on_prune', apply_node, reason) self.execute_callbacks('on_prune', apply_node, reason)
...@@ -416,6 +419,9 @@ class FunctionGraph(utils.object2): ...@@ -416,6 +419,9 @@ class FunctionGraph(utils.object2):
assert node not in self.apply_nodes assert node not in self.apply_nodes
self.__setup_node__(node) self.__setup_node__(node)
self.apply_nodes.add(node) self.apply_nodes.add(node)
if not hasattr(node.tag, 'imported_by'):
node.tag.imported_by = []
node.tag.imported_by.append(reason)
for output in node.outputs: for output in node.outputs:
self.__setup_r__(output) self.__setup_r__(output)
self.variables.add(output) self.variables.add(output)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论