( l: BaseNode, r: BaseNode, ctx: IntersectionContext )
| 192 | l.children.every((child, i) => sameBoundUnits(child, r.children[i]))) |
| 193 | |
| 194 | const _intersectNodes = ( |
| 195 | l: BaseNode, |
| 196 | r: BaseNode, |
| 197 | ctx: IntersectionContext |
| 198 | ) => { |
| 199 | const leftmostKind = l.precedence < r.precedence ? l.kind : r.kind |
| 200 | const implementation = |
| 201 | setImplementationsByKind[l.kind].intersections[r.kind] ?? |
| 202 | setImplementationsByKind[r.kind].intersections[l.kind] |
| 203 | if (implementation === undefined) { |
| 204 | // should be two ConstraintNodes that have no relation |
| 205 | // this could also happen if a user directly intersects a Type and a ConstraintNode, |
| 206 | // but that is not allowed by the external function signature |
| 207 | return null |
| 208 | } else if (leftmostKind === l.kind) return implementation(l, r, ctx) |
| 209 | else { |
| 210 | let result = implementation(r, l, { ...ctx, invert: !ctx.invert }) |
| 211 | if (result instanceof Disjoint) result = result.invert() |
| 212 | return result |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | const _pipeNodes = ( |
| 217 | l: nodeOfKind<RootKind>, |
no test coverage detected