ModuleParts
인터페이스, 작성 분류
The input shape module accepts: a Partial<ModuleDecl> whose funcs also takes a key-named record as an alternative to the array, and whose uses derives structs, bindings and consts from declarator handles.
import type { ModuleParts } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface ModuleParts extends Omit<Partial<ModuleDecl>, 'funcs'> { readonly funcs?: readonly FuncDecl[] | Readonly<Record<string, FuncDecl>>; readonly uses?: readonly UsesHandle[];}설명
Prefer the record funcs form when
the module’s function names are its own variable names; an anonymous fn(params, body)
is named by its key, with no separate name string to keep in sync. Prefer the array form
when order matters and the functions already carry explicit names.
예제
예제
export const SPRITE_MODULE: ModuleDecl = module({ structs: [U.struct, VsOut.decl], bindings: [U.binding, atlasTex.binding, atlasSmp.binding], funcs: [vs, fs],})인스턴스 속성
funcs선택 사항읽기 전용readonly FuncDecl[] | Readonly<Record<string, FuncDecl>>The functions, as an array in emit order or as a record whose keys name them.
uses선택 사항읽기 전용readonly UsesHandle[]Declarator handles; the module’s structs, bindings and consts are derived from them.
함께 보기
소스
src/core/ir/builder.ts, 1117행, 커밋 c66579bf 기준