|
30 | 30 | NodeProperties, |
31 | 31 | NodeProperty, |
32 | 32 | NodeResource, |
| 33 | + NodeResources, |
33 | 34 | NodeTemplate, |
34 | 35 | Nothing, |
35 | 36 | NothingType, |
@@ -1170,6 +1171,20 @@ def _resolve_resource_condition_reference(self, reference: TerminalValue) -> Pre |
1170 | 1171 | after = after_delta.after |
1171 | 1172 | return PreprocEntityDelta(before=before, after=after) |
1172 | 1173 |
|
| 1174 | + def visit_node_resources(self, node_resources: NodeResources): |
| 1175 | + """ |
| 1176 | + Skip resources where they conditionally evaluate to False |
| 1177 | + """ |
| 1178 | + for node_resource in node_resources.resources: |
| 1179 | + if not is_nothing(node_resource.condition_reference): |
| 1180 | + condition_delta = self._resolve_resource_condition_reference( |
| 1181 | + node_resource.condition_reference |
| 1182 | + ) |
| 1183 | + condition_after = condition_delta.after |
| 1184 | + if condition_after is False: |
| 1185 | + continue |
| 1186 | + self.visit(node_resource) |
| 1187 | + |
1173 | 1188 | def visit_node_resource( |
1174 | 1189 | self, node_resource: NodeResource |
1175 | 1190 | ) -> PreprocEntityDelta[PreprocResource, PreprocResource]: |
@@ -1280,6 +1295,14 @@ def visit_node_outputs( |
1280 | 1295 | before: list[PreprocOutput] = [] |
1281 | 1296 | after: list[PreprocOutput] = [] |
1282 | 1297 | for node_output in node_outputs.outputs: |
| 1298 | + if not is_nothing(node_output.condition_reference): |
| 1299 | + condition_delta = self._resolve_resource_condition_reference( |
| 1300 | + node_output.condition_reference |
| 1301 | + ) |
| 1302 | + condition_after = condition_delta.after |
| 1303 | + if condition_after is False: |
| 1304 | + continue |
| 1305 | + |
1283 | 1306 | output_delta: PreprocEntityDelta[PreprocOutput, PreprocOutput] = self.visit(node_output) |
1284 | 1307 | output_before = output_delta.before |
1285 | 1308 | output_after = output_delta.after |
|
0 commit comments