TS8079
프런트엔드 코드 HOST_RESERVED_FIELD
내보낸 바인딩의 클래스에 있는 필드 이름이 호스트 접근자의 멤버와 같습니다(규칙 6.1). 내보낸 uniform<T>의 클래스나 내보낸 스토리지 배열 원소의 클래스에서는 set, 내보낸 uniform<T>의 클래스에서는 needsUpdate와 dispose가 그렇습니다. 호스트는 접근자로 필드를 설정하므로(camera.pos.set(…)) 접근자와 같은 이름의 필드에는 닿을 수 없습니다.
레지스트리에는 이 상수에 대한 문서 주석이 없습니다. 그래서 위 설명은 컴파일러가 이 코드와 함께 내는 메시지를 보고 이 사이트가 쓴 것입니다.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
예제
"use typeshade"
export class Light { color: vec3 = vec3(1.) set: f32 = 1.}
export declare const light: uniform<Light>
@fragmentexport function main(): vec4 { return vec4(light.color * light.set, 1.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8079 error, 5행: "Light.set" is named like the host accessor's own method "set": "light" is a binding the module exports, a Uniform<Light> in the host, whose fields are properties of that accessor. Rename the field (Rule 6.1).
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"
export class Light { color: vec3 = vec3(1.) strength: f32 = 1.}
export declare const light: uniform<Light>
@fragmentexport function main(): vec4 { return vec4(light.color * light.strength, 1.)}이 코드가 적용하는 규칙
- 규칙 6.1 테스트
- A resource must be written
declare const x: uniform<T>,declare const x: storage<T>,declare const x: storage<T, "read_write">, ordeclare const x: <texture or sampler type>.
함께 보기
소스
커밋 af54ddad5에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.