Node
이 페이지에서

Node

클래스, IR 분류

The write-capable node.

import { Node } from 'typeshade'

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

구문

class Node<K extends string = string> extends ReadonlyNode<K>

설명

Every value-producing method and builtin, and Var(), return this subtype, which adds one method, .assign(), over the read-only ReadonlyNode base. Let(), a function parameter and a module constant are the ReadonlyNode supertype, so someLet.assign(…) is a tsc error. The split is type-level only: the runtime is one class, and the emitted WGSL and GLSL do not depend on which type a value carried.

인스턴스 메서드

assign (value: ArithArg<K>): void

this = value;, the one mutation method (the same shape as three.js TSL’s .assign()). JS cannot overload =: x = v would rebind the JS variable and emit nothing, so mutation is a method. For a compound update write x.assign(x.add(v)); add is the pure expression. The value lifts to this node’s scalar kind.

addAssign (value: ArithArg<K>): void

this += value; — the compound assignment, emitted as x += v on both targets. The same statement the "use typeshade" surface’s x += v lowers to, so a helper ported between the two authoring surfaces keeps its emit.

this.assign(this.add(value)) is the other spelling and emits x = (x + v). Both are correct; this one is shorter and is the one the seam is defined on.

subAssign (value: ArithArg<K>): void

this -= value;, the subtracting Node.addAssign.

mulAssign (value: ArithArg<K>): void

this *= value;, the multiplying Node.addAssign.

divAssign (value: ArithArg<K>): void

this /= value;, the dividing Node.addAssign.

관련 가이드

함께 보기

소스

src/core/ir/node.ts, 822행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고