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

Function staticProblemOf

ark/aot/interpreter.ts:3582–3595  ·  view source on GitHub ↗
(
	binding: Binding,
	module: SourceModule
)

Source from the content-addressed store, hash-verified

3580}
3581
3582const staticProblemOf = (
3583 binding: Binding,
3584 module: SourceModule
3585): string | undefined =>
3586 binding.kind === "catch" ? "is a caught error"
3587 : binding.kind === "member" || binding.kind === "namespace" ?
3588 "is declared in a TypeScript namespace or enum"
3589 : binding.isAmbient ? "is declared without a value"
3590 : binding.writes.length ?
3591 `is ${module.scopes.bindingsById.has(binding.writes[0]) ? "declared again" : "assigned"} at ${module.positionOf(binding.writes[0])}, so its value at the site is not known`
3592 : isLoopVariable(binding) ? "is a loop variable"
3593 : binding.kind === "var" && !isDeclaredInBody(binding) ?
3594 "is a `var` declared in a nested statement, which may not run"
3595 : undefined
3596
3597// e.g. not in a function or loop, which may run it again after a later write
3598const runsOnceIn = (node: Node, scope: Node): boolean => {

Callers 2

readBindingMethod · 0.85
exportValueMethod · 0.85

Calls 4

isLoopVariableFunction · 0.85
isDeclaredInBodyFunction · 0.85
positionOfMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected