MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / resolveAliasRuntime

Function resolveAliasRuntime

javascript/selenium-webdriver/generate_bidi.mjs:986–999  ·  view source on GitHub ↗

* Follows an alias chain (an alias can point at another alias) to the record/union * it ultimately resolves to, within `types` — one domain's own type map, the same * shape generateDomainFile already has, so this needs no extra generator plumbing. * Only a same-domain target is resolvable this wa

(node, types)

Source from the content-addressed store, hash-verified

984 * @returns {{runtimeName: string, kind: 'record'|'union'}|null}
985 */
986function resolveAliasRuntime(node, types) {
987 const seen = new Set()
988 let current = node
989 while (current?.kind === 'alias' && current.type?.ref && !seen.has(current.type.ref)) {
990 seen.add(current.type.ref)
991 const targetName = current.type.ref
992 const target = types[targetName]
993 if (target === undefined) return null // not in this domain — cross-domain, left unresolved
994 if (target.kind === 'record') return { runtimeName: normalizeDottedName(targetName), kind: 'record' }
995 if (target.kind === 'union') return { runtimeName: `${normalizeDottedName(targetName)}Union`, kind: 'union' }
996 current = target // another alias — keep resolving
997 }
998 return null
999}
1000
1001function generateDomainFile({ domain, className, types, commands, events, vendorModules = [], specVersion }) {
1002 const parts = [LICENSE_HEADER, '', GENERATED_NOTE]

Callers 1

generateDomainFileFunction · 0.85

Calls 3

normalizeDottedNameFunction · 0.85
addMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected