@yabgu_gm/tensionscript 0.13.0 → 0.13.2
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.
- package/dist/asc.generated.d.ts +101 -11
- package/dist/asc.js +1 -1
- package/dist/asc.js.map +1 -1
- package/dist/assemblyscript.generated.d.ts +101 -11
- package/dist/assemblyscript.js +17 -17
- package/dist/assemblyscript.js.map +3 -3
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
|
@@ -6730,6 +6730,79 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6730
6730
|
* value materialised somewhere, which is the return path, not this one.
|
|
6731
6731
|
*/
|
|
6732
6732
|
private expandSroaArrayArgument;
|
|
6733
|
+
/**
|
|
6734
|
+
* Compiles an array literal into one operand per element leaf, starting at
|
|
6735
|
+
* `at`, and returns how many were written.
|
|
6736
|
+
*
|
|
6737
|
+
* The operand sink of `emitSroaArrayLiteralLeaves`: the walk yields the leaves
|
|
6738
|
+
* and this places them, then fills any element the literal omitted — a WASM
|
|
6739
|
+
* operand cannot be left out, even when a local could (`fillSroaArrayFromLiteral`,
|
|
6740
|
+
* where zero is free).
|
|
6741
|
+
*/
|
|
6742
|
+
private pushSroaArrayLiteralOperands;
|
|
6743
|
+
/**
|
|
6744
|
+
* Compiles an array literal into one **leaf expression per leaf**, appended to
|
|
6745
|
+
* `leaves` in element-major order.
|
|
6746
|
+
*
|
|
6747
|
+
* **The one array-literal element walk.** Three positions use it: the call site
|
|
6748
|
+
* (`pushSroaArrayLiteralOperands`), the return
|
|
6749
|
+
* (`compileMultivalueReturnStatement`), and the local declaration
|
|
6750
|
+
* (`fillSroaArrayFromLiteral`). A value-form array's elements are leaves, and
|
|
6751
|
+
* the positions differ only in what they do with them — push operands, make a
|
|
6752
|
+
* tuple, or `local.set` — so the rules for *reading* a literal live here once.
|
|
6753
|
+
*
|
|
6754
|
+
* `verb` is `"passing"`, `"returning"` or `"initializing"`; it only chooses
|
|
6755
|
+
* the wording of the refusals.
|
|
6756
|
+
*
|
|
6757
|
+
* The elements a literal omits are **not** produced here: a WASM local starts
|
|
6758
|
+
* at zero, so a local declaration needs no stores for them, while an argument
|
|
6759
|
+
* or a return needs an operand and the caller fills it (`makeZero` per leaf
|
|
6760
|
+
* type). Two different destinations, one walk.
|
|
6761
|
+
*
|
|
6762
|
+
* A **long** literal is an arity error rather than a write past the leaf
|
|
6763
|
+
* block — `sum([1, 2, 3, 4, 5])` into a `[u32 * 4]` parameter reached Binaryen
|
|
6764
|
+
* with five operands for four slots and crashed the compiler, so this bound is
|
|
6765
|
+
* a guard, not a formality.
|
|
6766
|
+
*
|
|
6767
|
+
* A **record** element is several leaves, so it is read one leaf per field: an
|
|
6768
|
+
* object literal (`{ x: 1.5, y: 2.5 }`) compiles straight to them
|
|
6769
|
+
* (`emitSroaObjectElementLeaves`), and anything else — a record local, a call —
|
|
6770
|
+
* is refused by name, because a local there is a pointer, not the leaves.
|
|
6771
|
+
*/
|
|
6772
|
+
private emitSroaArrayLiteralLeaves;
|
|
6773
|
+
/**
|
|
6774
|
+
* Compiles one **object literal** element of a `[T * N]` array literal into
|
|
6775
|
+
* that element's field leaves, in declaration order.
|
|
6776
|
+
*
|
|
6777
|
+
* `{ x: 10.5, y: 20.5 }` is the natural way to write a record element, and for
|
|
6778
|
+
* an `@unmanaged struct` it can be compiled straight to leaves — no heap
|
|
6779
|
+
* record, no constructor, no pointer. The class path (`compileObjectLiteral`)
|
|
6780
|
+
* cannot be reused for it: that one requires a class, takes a temp local of
|
|
6781
|
+
* that class, and returns one reference, because it has to produce an
|
|
6782
|
+
* *address*. Measured on the same spelling: `const p: P = { x: 10.5 }` emits
|
|
6783
|
+
* `P#constructor` plus `__alloc(16)` and setters — a heap record, not a value.
|
|
6784
|
+
*
|
|
6785
|
+
* Policies, each measured against the class path so the two spellings agree:
|
|
6786
|
+
*
|
|
6787
|
+
* - **Declaration order.** Fields are emitted in the record's declaration
|
|
6788
|
+
* order, not the literal's, because the leaves are positional.
|
|
6789
|
+
* - **Last duplicate wins** — `{ x: 1.0, x: 2.0 }` is `2.0`, as measured for
|
|
6790
|
+
* `const p: P = { x: 1.0, x: 2.0 }`.
|
|
6791
|
+
* - **An unknown name is an error** at the name, matching
|
|
6792
|
+
* `compileObjectLiteral`'s `TS2339`.
|
|
6793
|
+
* - **An omitted field takes its declared default**, matching the constructor
|
|
6794
|
+
* the class path runs: measured, `{ x: 10.0 }` on `{ x = 5.0; y = 7.0 }`
|
|
6795
|
+
* yielded `y = 7.0`, not `0`. Only a **constant** default is reproduced
|
|
6796
|
+
* here; one that needs the record instance (`y = this.x * 2.0`) is refused
|
|
6797
|
+
* by name, because a leaf emission has no instance to evaluate it against.
|
|
6798
|
+
* - **A field left with no default is zero**, matching `{ x: 3.0 }` on a record
|
|
6799
|
+
* with no initialisers (measured: `y` came back `0`).
|
|
6800
|
+
*
|
|
6801
|
+
* A **nested** field (an `@inline struct` inside the record) is refused: its
|
|
6802
|
+
* value is a second set of leaves behind a second object literal, which is the
|
|
6803
|
+
* recursion this landing does not carry.
|
|
6804
|
+
*/
|
|
6805
|
+
private emitSroaObjectElementLeaves;
|
|
6733
6806
|
private expandSroaArgument;
|
|
6734
6807
|
/**
|
|
6735
6808
|
* The SROA local an expression names, or `null`.
|
|
@@ -6755,6 +6828,18 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
6755
6828
|
* carrying its own map, so the walk descends through it.
|
|
6756
6829
|
*/
|
|
6757
6830
|
private pushSroaLeafOperands;
|
|
6831
|
+
/**
|
|
6832
|
+
* Collects a `fieldLocals` tree's leaves into `out`, depth first.
|
|
6833
|
+
*
|
|
6834
|
+
* **The one definition of leaf order.** A nested value is a placeholder
|
|
6835
|
+
* (index `-1`) carrying its own map, so the walk descends through it rather
|
|
6836
|
+
* than yielding it. Every emitter that needs "the leaves of this value, in
|
|
6837
|
+
* order" goes through here — `pushSroaLeafOperands` for call operands, the
|
|
6838
|
+
* array-literal walk for literal elements, the local binder for stores — so
|
|
6839
|
+
* order is stated once instead of re-derived per site. It must agree with
|
|
6840
|
+
* `Signature.leafTypesOf`, which is the type-level twin.
|
|
6841
|
+
*/
|
|
6842
|
+
private collectSroaLeafLocals;
|
|
6758
6843
|
private resolveSroaReceiver;
|
|
6759
6844
|
/** Size of the static call-temp region, in bytes. 4 KB is 256 slots at the
|
|
6760
6845
|
* 16-byte fixture record size. Overflow aborts (see `makeSretCallBlock`);
|
|
@@ -7066,14 +7151,18 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
7066
7151
|
/**
|
|
7067
7152
|
* Stores an array literal's elements into a value-form array's leaves.
|
|
7068
7153
|
*
|
|
7069
|
-
*
|
|
7070
|
-
*
|
|
7071
|
-
*
|
|
7072
|
-
*
|
|
7073
|
-
*
|
|
7074
|
-
*
|
|
7075
|
-
*
|
|
7076
|
-
*
|
|
7154
|
+
* The **local-declaration sink** of `emitSroaArrayLiteralLeaves`: the walk
|
|
7155
|
+
* yields one expression per leaf in element-major order, and this local's
|
|
7156
|
+
* leaves were created in the same order (`fillSroaArrayLocals` keys them
|
|
7157
|
+
* `"0"`, `"1"`, ...), so the two line up positionally and a `local.set` per
|
|
7158
|
+
* pair is the whole job. No zero-fill: a WASM local starts at zero, so an
|
|
7159
|
+
* omitted element needs no store — which is why the walk does not produce one.
|
|
7160
|
+
*
|
|
7161
|
+
* A scalar element is one leaf. A **record** element is several, and the walk
|
|
7162
|
+
* refuses it by name: the object-literal spelling (`{ x: 1.5, y: 2.5 }`) goes
|
|
7163
|
+
* through the class path and *allocates* — measured, `const p: P = { x: 1.5 }`
|
|
7164
|
+
* emitted `P#constructor` plus setters and needed `env.abort`, i.e. a heap
|
|
7165
|
+
* record behind a pointer, which is not a value.
|
|
7077
7166
|
*/
|
|
7078
7167
|
private fillSroaArrayFromLiteral;
|
|
7079
7168
|
/**
|
|
@@ -7166,9 +7255,10 @@ declare module "types:tensionscript/src/compiler" {
|
|
|
7166
7255
|
* Returns a value-form `[T * N]` value as WASM multivalue results.
|
|
7167
7256
|
*
|
|
7168
7257
|
* One result per element leaf, element-major — the order `resultRefs` declares
|
|
7169
|
-
* and the caller's unpack indexes into.
|
|
7170
|
-
*
|
|
7171
|
-
* literal
|
|
7258
|
+
* and the caller's unpack indexes into. Two shapes reach here, and both end as
|
|
7259
|
+
* one operand per leaf: a value-form local pushes its SROA leaves, and a fresh
|
|
7260
|
+
* array literal compiles element by element through the same walk the call
|
|
7261
|
+
* site uses (`pushSroaArrayLiteralOperands`).
|
|
7172
7262
|
*
|
|
7173
7263
|
* Requires `Feature.MultiValue`, which `Resolver` turns on when it resolves
|
|
7174
7264
|
* this return type (`enableMultiValueOnce`), so a module that returns one of
|