CompileTsSourceResult
인터페이스, 작성 분류
The result of compiling a TypeShade TypeScript source string, including IR and optional WGSL.
import type { CompileTsSourceResult } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface CompileTsSourceResult { readonly hasDirective: boolean; readonly funcs: readonly FuncDecl[]; readonly diagnostics: readonly TsCompilerDiagnostic[]; readonly sourceFile: ts.SourceFile; readonly consts: readonly ConstDecl[]; readonly bindings: readonly BindingDecl[]; readonly structs: readonly CollectedStruct[]; readonly overrides: readonly OverrideDecl[]; readonly vars: readonly ModuleVarDecl[]; readonly enables: readonly DeclarableCapability[]; readonly directives: readonly DiagnosticDirective[]; readonly symbols: readonly DeclaredSymbol[]; readonly expressions: readonly LoweredExpression[]; readonly wgsl?: string;}인스턴스 속성
hasDirective읽기 전용booleanfuncs읽기 전용readonly FuncDecl[]diagnostics읽기 전용readonly TsCompilerDiagnostic[]sourceFile읽기 전용ts.SourceFileconsts읽기 전용readonly ConstDecl[]bindings읽기 전용readonly BindingDecl[]structs읽기 전용readonly CollectedStruct[]overrides읽기 전용readonly OverrideDecl[]Every
override<T>the module declares — WGSL specialization constants, which the pipeline sets and no pass folds. Empty for a module that declares none.vars읽기 전용readonly ModuleVarDecl[]Every module variable (
let x: workgroup<T>,let y: T = init, §24) the module declares. Empty for a module that declares none.enables읽기 전용readonly DeclarableCapability[]The capabilities the file’s
"enable <extension>";directives turn on (§50), by neutral id. Empty for a file that enables nothing, which is most; the two extension-gated@builtin(...)ids do not need one, sincerequiredCapsderives their capability from the use.directives읽기 전용readonly DiagnosticDirective[]The
diagnostic(severity, rule);directives the file’s entries ask for (§54), in source order. Empty for a file that asks for none, which is most. Carried here rather than left at the emit, because the assembledModuleDeclan example registers is built from this result — and a module missing the directive it was written with is one Tint refuses. Nameddirectivesand notdiagnostics: that name is taken, by the compiler’s own error list, and one of the two would have read as the other at every call site.symbols읽기 전용readonly DeclaredSymbol[]Every name the front end declared while lowering
sourceFile, with theShaderTypeit gave it and the UTF-16 span of the declared name: the table an editor answers “what type is this symbol” from, since TypeScript infers plainnumberfor a numeric literal that the compiler typesf32. Empty when nothing was lowered (no directive, a parse error). A side output: nothing here feeds lowering, the IR or emitted text. SeeDeclaredSymbol.expressions읽기 전용readonly LoweredExpression[]Every expression the front end lowered in
sourceFile, with theShaderTypeit gave it and its UTF-16 span, in source order: the table an editor’s own type for an expression is held to (Rule 12.7, 0015). A span lowered to two types is left out, and a refused expression records nothing. Empty when nothing was lowered. A side output, likesymbols: nothing here feeds lowering, the IR or emitted text. SeeLoweredExpression.wgsl선택 사항읽기 전용string
소스
src/compiler/ts/source-file.ts, 139행, 커밋 c66579bf 기준