@yabgu_gm/tensionscript 0.11.4 → 0.13.0
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/README.md +3 -1
- package/dist/asc.generated.d.ts +856 -21
- package/dist/asc.js +40 -1
- package/dist/asc.js.map +2 -2
- package/dist/assemblyscript.generated.d.ts +856 -21
- package/dist/assemblyscript.js +179 -179
- package/dist/assemblyscript.js.map +3 -3
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +3 -1
- package/std/assembly/dynamicarray.ts +39 -0
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"@yabgu_gm/tensionscript": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.
|
|
4
|
-
"@yabgu_gm/tensionscript/asc": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.
|
|
3
|
+
"@yabgu_gm/tensionscript": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.13.0/dist/assemblyscript.js",
|
|
4
|
+
"@yabgu_gm/tensionscript/asc": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.13.0/dist/asc.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@131.0.0-nightly.20260721/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var TENSIONSCRIPT_VERSION = "0.
|
|
1
|
+
var TENSIONSCRIPT_VERSION = "0.13.0";
|
|
2
2
|
var TENSIONSCRIPT_IMPORTMAP = {
|
|
3
3
|
"imports": {
|
|
4
|
-
"@yabgu_gm/tensionscript": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.
|
|
5
|
-
"@yabgu_gm/tensionscript/asc": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.
|
|
4
|
+
"@yabgu_gm/tensionscript": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.13.0/dist/assemblyscript.js",
|
|
5
|
+
"@yabgu_gm/tensionscript/asc": "https://cdn.jsdelivr.net/npm/@yabgu_gm/tensionscript@0.13.0/dist/asc.js",
|
|
6
6
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@131.0.0-nightly.20260721/index.js",
|
|
7
7
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"tensionscript",
|
|
9
9
|
"wasm"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.13.0",
|
|
12
12
|
"author": "Daniel Wirtz <dcode+assemblyscript@dcode.io>",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"homepage": "https://github.com/Yabgu/Tension",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"check": "npm run check:config && npm run check:import && npm run lint",
|
|
78
78
|
"check:config": "tsc --noEmit -p src --diagnostics --listFiles",
|
|
79
79
|
"check:import": "tsc --noEmit --skipLibCheck --target ESNEXT --module nodenext --moduleResolution nodenext --experimentalDecorators tests/import/index",
|
|
80
|
+
"check:headers": "bash scripts/check-headers.sh",
|
|
80
81
|
"lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
|
|
81
82
|
"build": "node scripts/build",
|
|
82
83
|
"watch": "node scripts/build --watch",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"test:flags": "node --enable-source-maps tests/flags.js",
|
|
88
89
|
"test:async": "node --enable-source-maps tests/async/resolver.js && node --enable-source-maps tests/async/lower.js && node --enable-source-maps tests/async/runtime.js",
|
|
89
90
|
"test:compiler": "node --enable-source-maps --no-warnings tests/compiler",
|
|
91
|
+
"test:bootstrap": "npm run bootstrap:debug && npm run test:compiler -- --wasm build/assemblyscript.debug-bootstrap.js",
|
|
90
92
|
"test:browser": "node --enable-source-maps tests/browser",
|
|
91
93
|
"test:asconfig": "cd tests/asconfig && npm run test",
|
|
92
94
|
"test:transform": "npm run test:transform:esm && npm run test:transform:cjs",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference path="./rt/index.d.ts" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The descriptor behind `@managed @dynamic [T * n]`.
|
|
5
|
+
*
|
|
6
|
+
* A managed dynamic array is a **GC reference** to one of these, so the value is
|
|
7
|
+
* traced, rooted and nullable exactly like any other class reference. That is
|
|
8
|
+
* the whole reason this is a class rather than a compiler-internal `Type` with
|
|
9
|
+
* a "managed" flag: a `TypeKind.DynamicArray` carries `TypeFlags.None`, which
|
|
10
|
+
* makes `Type#isManaged` answer false (`types.ts`), which makes the collector
|
|
11
|
+
* skip a local holding it. The buffer would then be freed under a live
|
|
12
|
+
* descriptor — use-after-free by construction.
|
|
13
|
+
*
|
|
14
|
+
* Layout note: the **data buffer is bare**. It has no length header, unlike
|
|
15
|
+
* `@unmanaged @dynamic [T * n]`, because this descriptor owns the length. So
|
|
16
|
+
* `y[i]` is `dataPtr + i*sizeof(T)`, with no header offset — the opposite of the
|
|
17
|
+
* unmanaged form, where the buffer describes itself so that C can build one.
|
|
18
|
+
*
|
|
19
|
+
* Two layouts, one syntax family, differing only by memory model. That is
|
|
20
|
+
* deliberate: `@unmanaged` is the self-describing C-facing form, `@managed` is
|
|
21
|
+
* the GC-traced form whose length travels in this object. Putting a header in
|
|
22
|
+
* front of the data as well would give one length two sources of truth.
|
|
23
|
+
*
|
|
24
|
+
* This class is not meant to be constructed by user code. Landing 4d.1 makes
|
|
25
|
+
* `@managed @dynamic [T * n]` **resolve** to it; construction (the two-argument
|
|
26
|
+
* `changetype`) and indexing are Landing 4d.2.
|
|
27
|
+
*/
|
|
28
|
+
@final
|
|
29
|
+
export class DynamicArray<T> {
|
|
30
|
+
/** Address of the first element. Caller-owned; not traced. */
|
|
31
|
+
dataPtr: usize;
|
|
32
|
+
/** Number of elements. Read as a class field, so no header load. */
|
|
33
|
+
length: u32;
|
|
34
|
+
|
|
35
|
+
constructor(dataPtr: usize, length: u32) {
|
|
36
|
+
this.dataPtr = dataPtr;
|
|
37
|
+
this.length = length;
|
|
38
|
+
}
|
|
39
|
+
}
|