(binding: Binding, ctx: Context)
| 1698 | } |
| 1699 | |
| 1700 | private declaredValue(binding: Binding, ctx: Context): unknown { |
| 1701 | const declarator = binding.declaration |
| 1702 | if (declarator.type !== "VariableDeclarator") { |
| 1703 | return new DynamicValue( |
| 1704 | ctx.module, |
| 1705 | binding.id, |
| 1706 | `\`${binding.name}\` is a TypeScript import-equals declaration` |
| 1707 | ) |
| 1708 | } |
| 1709 | if (!declarator.init) return undefined |
| 1710 | if (declarator.id.type === "Identifier") |
| 1711 | return this.evaluate(declarator.init, ctx) |
| 1712 | const init = this.nodeValue(declarator.init, ctx.module) |
| 1713 | if (init.error !== undefined) throw init.error |
| 1714 | mergeTrace(ctx.trace, init.trace) |
| 1715 | const env = createEnvironment(undefined) |
| 1716 | this.destructure(declarator.id, init.value, { ...ctx, env }) |
| 1717 | return env.valuesByBinding.get(binding) |
| 1718 | } |
| 1719 | |
| 1720 | private evaluateEnum(binding: Binding, ctx: Context): unknown { |
| 1721 | const declaration = binding.declaration as Extract< |
no test coverage detected