* Apply Selenium overlay CDDL (see common/bidi/) to the parsed upstream AST: any * production an overlay defines replaces the identically named upstream one, which is * dropped. Kept here rather than in the shared CDDL merge so the overlay is a * schema-generation concern only — the upstream gram
(ast, overrideArgs)
| 209 | * any other definition. |
| 210 | */ |
| 211 | function applyOverrides(ast, overrideArgs) { |
| 212 | if (!overrideArgs.length) return ast |
| 213 | const overrides = overrideArgs.flatMap((arg) => parseCddl(arg)) |
| 214 | const names = new Set(overrides.filter((d) => d?.Name).map((d) => d.Name)) |
| 215 | return [...ast.filter((d) => !(d?.Name && names.has(d.Name))), ...overrides] |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Apply Selenium vendor overlay CDDL (see common/bidi/*-extensions.cddl) to the AST. |