MCPcopy Create free account
hub / github.com/arktypeio/arktype / declaredValue

Method declaredValue

ark/aot/interpreter.ts:1700–1718  ·  view source on GitHub ↗
(binding: Binding, ctx: Context)

Source from the content-addressed store, hash-verified

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<

Callers 1

bindingValueMethod · 0.95

Calls 6

evaluateMethod · 0.95
nodeValueMethod · 0.95
destructureMethod · 0.95
mergeTraceFunction · 0.85
createEnvironmentFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected