TS8018
프런트엔드 코드 ASSIGN_TARGET
An assignment or ++/-- target that is not a writable place, such as a temporary or an input that has no writable value local.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
발생 조건
An assignment or ++/-- target that is not a writable place, such as a temporary or an input that has no writable value local. Whole writes to ordinary value parameters use automatic local copies. Unknown names use UNKNOWN_NAME; writes to known immutable bindings use CONST_ASSIGN.
예제
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { vec2(uv).x = 1. return vec4(uv, 0., 1.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8018 error, 5행: Assignment target must be a name, or a field, component or element of one.
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { let st = uv st.x = 1. return vec4(st, 0., 1.)}이 코드가 적용하는 규칙
- 규칙 8.11 테스트
- A
getorsetaccessor is a function of the module,Owner_get_xorOwner_set_x, which takes its object as a method does (Rule 8.10); a read ofo.xmust call the getter, and an assignment, a compound assignment,++and--must call the setter with the new value, the compound forms reading the old one through the getter. - 규칙 8.17 테스트
- A local function (a
constthat holds an arrow function or a function expression, or afunctiondeclaration, written inside a function’s body) is a function of the module named after the body that declares it (surface §14), and it may read and write the variables of the functions around it, as a TypeScript closure does.
함께 보기
-
TS8005CONST_ASSIGN const나 읽기 전용 리소스처럼 바뀔 수 없는 이름에 값을 대입합니다.-
TS8022UNKNOWN_NAME - Reference to a name TypeShade cannot resolve (identifier, struct field, or struct shape) that is not a function call (
UNKNOWN_FN) or a type name (UNKNOWN_TYPE), in a body a call lowers or in one no call lowers; a name the library declares for TypeScript's own use (Object,Math,Symbol), or the file declares as an enum, a namespace, a class or a type, read as a value says what it is.
소스
커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.