( node: Node, module: SourceModule, seen = new Set<Binding>() )
| 1366 | const emptyStringSet: ReadonlySet<string> = new Set() |
| 1367 | |
| 1368 | const constantKeyOf = ( |
| 1369 | node: Node, |
| 1370 | module: SourceModule, |
| 1371 | seen = new Set<Binding>() |
| 1372 | ): string | undefined => { |
| 1373 | node = unwrapExpression(node) |
| 1374 | if (node.type === "Literal") { |
| 1375 | return typeof node.value === "string" || typeof node.value === "number" ? |
| 1376 | String(node.value) |
| 1377 | : undefined |
| 1378 | } |
| 1379 | if (node.type === "TemplateLiteral" && !node.expressions.length) |
| 1380 | return node.quasis[0].value.cooked ?? undefined |
| 1381 | if (node.type !== "Identifier") return |
| 1382 | const binding = module.scopes.byId.get(node)?.binding |
| 1383 | if (!binding || binding.kind !== "const" || seen.has(binding)) return |
| 1384 | seen.add(binding) |
| 1385 | const { declaration } = binding |
| 1386 | return ( |
| 1387 | declaration.type === "VariableDeclarator" && |
| 1388 | declaration.id === binding.id && |
| 1389 | declaration.init |
| 1390 | ) ? |
| 1391 | constantKeyOf(declaration.init, module, seen) |
| 1392 | : undefined |
| 1393 | } |
| 1394 | |
| 1395 | const staticMemberKeyOf = ( |
| 1396 | member: Extract<Node, { type: "MemberExpression" }>, |
no test coverage detected