ExternFn
이 페이지에서

ExternFn

타입, 작성 분류

A typed call-only handle for a function whose definition is provided elsewhere: the forward-declaration counterpart to fn().

import type { ExternFn } from 'typeshade'

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

구문

type ExternFn<P extends ParamSpec, R extends ShaderType> = {
/** Typed object-param call, with the same argument union as {@link FnHandle}: arguments
* are read, so read-only nodes (`Let` results, parameters) and raw numbers, lifted to the
* declared parameter type, are accepted. */
(args: { readonly [K in keyof P]: ReadonlyNode<KeyOf<P[K]>> | number }): Node<KeyOf<R>>;
/** Positional call. Arguments are matched to the parameters in declaration order. */
(...args: NodeLike[]): Node<KeyOf<R>>;
};

설명

Use it when the callee cannot be an importable FnHandle at the caller’s module-load time, for instance a function a host builds from configuration after the calling module has already authored its body. The handle carries only the signature (name, parameter types and return type), so the caller makes a typed call now, object-param f({ a, b }) or positional f(a, b), and the host links the body in at emit. The emitted node is a call by name.

함께 보기

소스

src/core/ir/builder.ts, 1048행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고