installStmtSink()
Function in IR
Installs the statement sink that Node.assign() writes through.
import { installStmtSink } from 'typeshade/core/ir'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
const installStmtSink: (s: StmtSink) => voidParameters
sStmtSink
Return value
void
Description
The node module cannot
import the builder (the two would import each other), so the builder registers its own
{ assign } implementation here once, when it loads. Authoring code calls .assign() on a
node and never calls this directly; a host that supplies its own statement builder is the
only other caller.
Examples
Example
import { typeKey } from 'typeshade'import { installStmtSink } from 'typeshade/core/ir'
// Record every `.assign()` instead of building a statement.const log: string[] = []installStmtSink({ assign: (target, value) => { log.push(`${typeKey(target.type)} = ${typeKey(value.type)}`) },})Source
src/core/ir/node.ts, line 163, at commit af54ddad5