( targetNode: Node, deep: boolean, isDomainUnit: boolean, regionNode: Node | null, extractOnly: boolean, )
| 20 | 'forward', |
| 21 | ] |
| 22 | const clearNodeNormalized = ( |
| 23 | targetNode: Node, |
| 24 | deep: boolean, |
| 25 | isDomainUnit: boolean, |
| 26 | regionNode: Node | null, |
| 27 | extractOnly: boolean, |
| 28 | ) => { |
| 29 | targetNode.next.length = 0 |
| 30 | targetNode.seq.length = 0 |
| 31 | //@ts-expect-error |
| 32 | targetNode.scope = null |
| 33 | let currentNode |
| 34 | let list = getLinks(targetNode) |
| 35 | const {stateRef, defaultShape, isRegion: isRegionNode, op} = targetNode.meta |
| 36 | if (stateRef) { |
| 37 | stateRef.before = [] |
| 38 | targetNode.meta.stateRef = null |
| 39 | } |
| 40 | if (defaultShape) { |
| 41 | for (const key in defaultShape) { |
| 42 | defaultShape[key] = null |
| 43 | } |
| 44 | } |
| 45 | const nextRegionNode = isRegionNode ? targetNode : regionNode |
| 46 | if (list.length > 0) { |
| 47 | const targetIsOp = includes(nonPassableNodes, op) |
| 48 | const canGoDeep = !isRegionNode && !extractOnly |
| 49 | const domainSampleEdgeCase = canGoDeep && isDomainUnit && !targetIsOp |
| 50 | while ((currentNode = list.pop())) { |
| 51 | const isTrigger = includes(currentNode.next, targetNode) |
| 52 | removeFromNode(currentNode, targetNode) |
| 53 | if (isRegionNode) { |
| 54 | clearNodeNormalized(currentNode, false, false, targetNode, true) |
| 55 | } |
| 56 | if (!isTrigger) { |
| 57 | currentNode.family.triggers -= 1 |
| 58 | } |
| 59 | if ( |
| 60 | deep || |
| 61 | domainSampleEdgeCase || |
| 62 | (canGoDeep && currentNode.family.type === CROSSLINK && !targetIsOp) || |
| 63 | (extractOnly && |
| 64 | includes(nonPassableNodes, currentNode.meta.op) && |
| 65 | ((isTrigger && currentNode.next.length === 0) || |
| 66 | (!isTrigger && currentNode.family.triggers <= 0))) |
| 67 | ) { |
| 68 | clearNodeNormalized( |
| 69 | currentNode, |
| 70 | deep, |
| 71 | isDomainUnit && currentNode.meta.op !== 'on', |
| 72 | nextRegionNode, |
| 73 | extractOnly, |
| 74 | ) |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | list = getOwners(targetNode) |
| 79 | while ((currentNode = list.pop())) { |
no test coverage detected
searching dependent graphs…