@yabgu_gm/tensionscript 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4597,6 +4597,16 @@ declare module "types:tensionscript/src/program" {
4597
4597
  * (there are none: a view has no per-field locals to copy into).
4598
4598
  */
4599
4599
  isViewParam: boolean;
4600
+ /**
4601
+ * Whether this local is a **view local**: `const p = changetype<@unmanaged T>(ptr)`
4602
+ * where `T` is an inline type.
4603
+ *
4604
+ * The same idea as {@link isViewParam} — the local holds an address, not a
4605
+ * value — but a body local rather than a parameter. `type` stays the record
4606
+ * type, because that is what makes `p.field` resolve; `getNonParameterLocalTypes`
4607
+ * is what gives it one `i32` slot instead of the record's reference type.
4608
+ */
4609
+ isViewLocal: boolean;
4600
4610
  /** Constructs a new local variable. */
4601
4611
  constructor(
4602
4612
  /** Simple name. */
@@ -6063,7 +6073,35 @@ declare module "types:tensionscript/src/compiler" {
6063
6073
  checkSignatureSupported(signature: Signature, reportNode: FunctionTypeNode): boolean;
6064
6074
  /** Is `type` an `@inline struct`: a value carried as its fields, never as a
6065
6075
  * pointer? */
6076
+ /**
6077
+ * Whether `node` is syntactically `changetype<@unmanaged T>(...)`.
6078
+ *
6079
+ * The resolver's `isViewCall` is authoritative once the call has been
6080
+ * compiled, but `compileSroaLocal` decides *before* compiling the initialiser,
6081
+ * so it has to read the shape off the AST. The two agree: the mark is set
6082
+ * from exactly this test (`compileCallExpressionBuiltin`).
6083
+ */
6084
+ private isUnmanagedChangetype;
6066
6085
  private isInlineStructType;
6086
+ /**
6087
+ * Reads `field` through a view of the record's bytes at `basePtr`.
6088
+ *
6089
+ * A scalar field is a load at its offset. A field whose type is itself an
6090
+ * `@inline struct` is **not** a load: the field is bytes inside the viewed
6091
+ * record, so what the caller needs is their *address* — `basePtr + offset` —
6092
+ * the same shape the declared-`@unmanaged` path produces through the
6093
+ * inline-field branch of `compilePropertyAccess`, and the same `i32` a
6094
+ * record accessor takes as `this`.
6095
+ *
6096
+ * Loading it instead was a silent miscompile: a 4-byte load of the field's
6097
+ * first bytes was handed to the inner setter as if it were a pointer.
6098
+ * Measured — `changetype<@unmanaged R>(ptr).pos.x = v` read a float's bit
6099
+ * pattern as an address and trapped with `memory access out of bounds`.
6100
+ *
6101
+ * A fixed-array field is storage for the same reason, so it takes the address
6102
+ * branch too.
6103
+ */
6104
+ private viewFieldAccess;
6067
6105
  /** The WASM result type of a value of `type`: `None` for an `@inline struct`,
6068
6106
  * whose value is written to the caller's slot instead of returned. Calling
6069
6107
  * `type.toRef()` on an inline struct is what this replaces — it has no