@yabgu_gm/tensionscript 0.11.1 → 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.
@@ -621,7 +621,8 @@ declare module "types:tensionscript/src/diagnosticMessages.generated" {
621
621
  _abi_align_0_is_less_than_the_field_type_s_natural_alignment_1_asking_for_less_is_a_lie_so_it_is_refused_rather_than_silently_ignored = 6408,
622
622
  _abi_align_0_is_too_large_the_maximum_is_1 = 6409,
623
623
  Alignment_is_a_property_of_the_field_not_its_type_Place_abi_align_N_on_the_field_declaration = 6410,
624
- A_view_parameter_unmanaged_0_over_an_inline_type_cannot_appear_in_a_host_visible_signature_an_external_or_exported_parameter_is_supplied_by_the_host_and_a_view_is_an_address_this_compiler_did_not_materialise = 6411
624
+ A_view_parameter_unmanaged_0_over_an_inline_type_cannot_appear_in_a_host_visible_signature_an_external_or_exported_parameter_is_supplied_by_the_host_and_a_view_is_an_address_this_compiler_did_not_materialise = 6411,
625
+ Call_to_0_emits_1_operands_but_its_signature_declares_2 = 6412
625
626
  }
626
627
  /** Translates a diagnostic code to its respective string. */
627
628
  export function diagnosticCodeToString(code: DiagnosticCode): string;
@@ -4596,6 +4597,16 @@ declare module "types:tensionscript/src/program" {
4596
4597
  * (there are none: a view has no per-field locals to copy into).
4597
4598
  */
4598
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;
4599
4610
  /** Constructs a new local variable. */
4600
4611
  constructor(
4601
4612
  /** Simple name. */
@@ -5901,6 +5912,18 @@ declare module "types:tensionscript/src/compiler" {
5901
5912
  private needToStack;
5902
5913
  /** Marks managed call operands for the shadow stack. */
5903
5914
  private operandsTostack;
5915
+ /**
5916
+ * Checks that the operands about to be passed match the WASM arity the callee
5917
+ * declares, and reports a clean diagnostic when they do not.
5918
+ *
5919
+ * The invariant is maintained by the default-argument filling in
5920
+ * `makeCallDirect`; this guard exists because when that filling misses — as it
5921
+ * did for an sret callee with an omitted optional argument — the mismatch
5922
+ * reached the WASM validator as `call* param number must match`, which names a
5923
+ * binaryen rule and never mentions the call that broke it. A wrong arity is a
5924
+ * compiler bug, so it should say so at the call site.
5925
+ */
5926
+ private checkCallArity;
5904
5927
  /** Creates a direct call to the specified function. */
5905
5928
  makeCallDirect(instance: Function, operands: ExpressionRef[] | null, reportNode: Node, immediatelyDropped?: boolean): ExpressionRef;
5906
5929
  /** Compiles an indirect call to a first-class function. */
@@ -6050,7 +6073,35 @@ declare module "types:tensionscript/src/compiler" {
6050
6073
  checkSignatureSupported(signature: Signature, reportNode: FunctionTypeNode): boolean;
6051
6074
  /** Is `type` an `@inline struct`: a value carried as its fields, never as a
6052
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;
6053
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;
6054
6105
  /** The WASM result type of a value of `type`: `None` for an `@inline struct`,
6055
6106
  * whose value is written to the caller's slot instead of returned. Calling
6056
6107
  * `type.toRef()` on an inline struct is what this replaces — it has no