selectGuardedArm()
함수, 배리언트 분류
Recover the arm a set of defined macros selects from an emitGuarded source.
import { selectGuardedArm } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function selectGuardedArm(source: string, defined: Iterable<string>): string | undefined매개변수
sourcestringoutput of
VariantFamily.emitGuarded.definedIterable<string>the macro names the host would have defined.
반환값
string | undefined
the selected arm’s text, or undefined when no arm matches.
예외
ErrorErrorwhen a condition insourceis not of the form the ladder generates.
설명
Understands only the ladder shape emitGuarded generates: #if, #elif and #endif at
column 0, with conditions built from defined(X) and !defined(X) joined by &&. Use it
to assert, in a test or a build step, that the arm the host’s defines select equals the
standalone variant from VariantFamily.emit, without running a compiler.
함께 보기
소스
src/core/variant-family.ts, 180행, 커밋 c66579bf 기준