CompileTsSourceResult
이 페이지에서

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읽기 전용 boolean
funcs읽기 전용 readonly FuncDecl[]
diagnostics읽기 전용 readonly TsCompilerDiagnostic[]
sourceFile읽기 전용 ts.SourceFile
consts읽기 전용 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, since requiredCaps derives 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 assembled ModuleDecl an example registers is built from this result — and a module missing the directive it was written with is one Tint refuses. Named directives and not diagnostics: 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 the ShaderType it 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 plain number for a numeric literal that the compiler types f32. Empty when nothing was lowered (no directive, a parse error). A side output: nothing here feeds lowering, the IR or emitted text. See DeclaredSymbol.

expressions읽기 전용 readonly LoweredExpression[]

Every expression the front end lowered in sourceFile, with the ShaderType it 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, like symbols: nothing here feeds lowering, the IR or emitted text. See LoweredExpression.

wgsl선택 사항읽기 전용 string

소스

src/compiler/ts/source-file.ts, 139행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고