murashit_codex-panel/scripts/grit/source-shape/no-self-referential-initializer-callback.grit
2026-06-27 23:43:56 +09:00

7 lines
355 B
Text

language js
`const $name = new $constructor($callback)` as $stmt where {
or { $callback <: `() => $body`, $callback <: `function() { $body }` },
$body <: contains `$name`,
register_diagnostic(span=$stmt, message="Avoid referencing a variable from a callback inside its own initializer; declare it first with an explicit type.", severity="error")
}