installStmtSink
이 페이지에서

installStmtSink()

함수, IR 분류

Installs the statement sink that Node.assign() writes through.

import { installStmtSink } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const installStmtSink: (s: StmtSink) => void

매개변수

s StmtSink

반환값

void

설명

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.

예제

예제

import { installStmtSink, typeKey } from 'typeshade'
// Record every `.assign()` instead of building a statement.
const log: string[] = []
installStmtSink({
assign: (target, value) => {
log.push(`${typeKey(target.type)} = ${typeKey(value.type)}`)
},
})

소스

src/core/ir/node.ts, 204행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고