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

Function resolveAliasRuntime

javascript/selenium-webdriver/generate_bidi.mjs:927–940  ·  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

925 * @returns {{runtimeName: string, kind: 'record'|'union'}|null}
926 */
927function resolveAliasRuntime(node, types) {
928 const seen = new Set()
929 let current = node
930 while (current?.kind === 'alias' && current.type?.ref && !seen.has(current.type.ref)) {
931 seen.add(current.type.ref)
932 const targetName = current.type.ref
933 const target = types[targetName]
934 if (target === undefined) return null // not in this domain — cross-domain, left unresolved
935 if (target.kind === 'record') return { runtimeName: normalizeDottedName(targetName), kind: 'record' }
936 if (target.kind === 'union') return { runtimeName: `${normalizeDottedName(targetName)}Union`, kind: 'union' }
937 current = target // another alias — keep resolving
938 }
939 return null
940}
941
942function generateDomainFile({ domain, className, types, commands, events, vendorModules = [], specVersion }) {
943 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