(a, b)
| 200 | * @returns {RuntimeSpec} merged |
| 201 | */ |
| 202 | const mergeRuntime = (a, b) => { |
| 203 | if (a === undefined) { |
| 204 | return b; |
| 205 | } else if (b === undefined) { |
| 206 | return a; |
| 207 | } else if (a === b) { |
| 208 | return a; |
| 209 | } else if (typeof a === "string") { |
| 210 | if (typeof b === "string") { |
| 211 | /** @type {RuntimeSpecSortableSet} */ |
| 212 | const set = new SortableSet(); |
| 213 | set.add(a); |
| 214 | set.add(b); |
| 215 | return set; |
| 216 | } else if (b.has(a)) { |
| 217 | return b; |
| 218 | } |
| 219 | /** @type {RuntimeSpecSortableSet} */ |
| 220 | const set = new SortableSet(b); |
| 221 | set.add(a); |
| 222 | return set; |
| 223 | } |
| 224 | if (typeof b === "string") { |
| 225 | if (a.has(b)) return a; |
| 226 | /** @type {RuntimeSpecSortableSet} */ |
| 227 | const set = new SortableSet(a); |
| 228 | set.add(b); |
| 229 | return set; |
| 230 | } |
| 231 | /** @type {RuntimeSpecSortableSet} */ |
| 232 | const set = new SortableSet(a); |
| 233 | for (const item of b) set.add(item); |
| 234 | if (set.size === a.size) return a; |
| 235 | return set; |
| 236 | }; |
| 237 | |
| 238 | /** |
| 239 | * Merges runtime condition. |
no test coverage detected