(spec: GoVariantMatchSpec)
| 1489 | } |
| 1490 | |
| 1491 | function groupGoJSONMatchTerms(spec: GoVariantMatchSpec): GoJSONMatchTermGroup[] { |
| 1492 | const groups = new Map<string, GoJSONMatchTermGroup>(); |
| 1493 | const getGroup = (parentPath: string[]): GoJSONMatchTermGroup => { |
| 1494 | const key = goJSONMatchPathKey(parentPath); |
| 1495 | const existing = groups.get(key); |
| 1496 | if (existing) return existing; |
| 1497 | const group = { parentPath, positiveTerms: [], negativeProperties: [] }; |
| 1498 | groups.set(key, group); |
| 1499 | return group; |
| 1500 | }; |
| 1501 | |
| 1502 | for (const term of spec.positiveTerms) { |
| 1503 | getGroup(goJSONMatchTermParentPath(term)).positiveTerms.push(term); |
| 1504 | } |
| 1505 | for (const path of spec.negativeExistsPaths) { |
| 1506 | const group = getGroup(goJSONMatchPathParentPath(path)); |
| 1507 | group.negativeProperties.push(goJSONMatchPathProperty(path)); |
| 1508 | } |
| 1509 | |
| 1510 | return [...groups.values()] |
| 1511 | .map((group) => ({ |
| 1512 | parentPath: group.parentPath, |
| 1513 | positiveTerms: group.positiveTerms.sort(compareGoJSONMatchTerms), |
| 1514 | negativeProperties: [...new Set(group.negativeProperties)].sort(), |
| 1515 | })) |
| 1516 | .sort((left, right) => compareGoJSONPaths(left.parentPath, right.parentPath)); |
| 1517 | } |
| 1518 | |
| 1519 | function goJSONRawStructFields(propNames: string[]): Map<string, string> { |
| 1520 | const fieldNames = new Map<string, string>(); |
no test coverage detected
searching dependent graphs…