Comparing version
@@ -608,3 +608,3 @@ /// <reference path="./index.d.ts" /> | ||
// @ts-ignore: Defined by transform | ||
if (isDefined(type.__INITIALIZE)) out.__INITIALIZE(); | ||
if (isNullable<T>() && isDefined(type.__INITIALIZE)) out.__INITIALIZE(); | ||
// @ts-ignore: Defined by transform | ||
@@ -611,0 +611,0 @@ return out.__DESERIALIZE(srcStart, srcEnd, out); |
@@ -0,5 +1,4 @@ | ||
import { JSON } from "../assembly/index"; | ||
import { bs } from "../lib/as-bs"; | ||
import { JSON } from "."; | ||
@json | ||
@@ -28,3 +27,2 @@ class Vec3 { | ||
@inline | ||
@@ -210,3 +208,2 @@ __INITIALIZE(): this { | ||
@json | ||
@@ -220,13 +217,8 @@ class Player { | ||
@omitif((self: this): boolean => self.age < 18) | ||
age!: i32; | ||
@omitnull() | ||
pos!: Vec3 | null; | ||
isVerified!: boolean; | ||
__SERIALIZE(ptr: usize): void { | ||
bs.proposeSize(160); | ||
let block: usize = 0; | ||
bs.proposeSize(158); | ||
store<u16>(bs.offset, 123, 0); | ||
@@ -242,10 +234,2 @@ bs.offset += 2; | ||
} | ||
if ((block = load<usize>(ptr, offsetof<this>("pos"))) !== 0) { | ||
store<u64>(bs.offset, 32370099070435362, 0); | ||
store<u32>(bs.offset, 3801122, 8); | ||
bs.offset += 12; | ||
JSON.__serialize<Vec3 | null>(load<Vec3 | null>(ptr, offsetof<this>("pos"))); | ||
store<u16>(bs.offset, 44, 0); | ||
bs.offset += 2; | ||
} | ||
store<u64>(bs.offset, 32088598323265570, 0); | ||
@@ -268,2 +252,7 @@ store<u64>(bs.offset, 30962384884727923, 8); | ||
JSON.__serialize<Array<i32>>(load<Array<i32>>(ptr, offsetof<this>("lastActive"))); | ||
store<u64>(bs.offset, 31244203453448236, 0); | ||
store<u32>(bs.offset, 2228339, 8); | ||
store<u16>(bs.offset, 58, 12); | ||
bs.offset += 14; | ||
JSON.__serialize<Vec3 | null>(load<Vec3 | null>(ptr, offsetof<this>("pos"))); | ||
store<u64>(bs.offset, 32370073295519788, 0); | ||
@@ -279,3 +268,2 @@ store<u64>(bs.offset, 29555362187509846, 8); | ||
@inline | ||
@@ -567,6 +555,8 @@ __INITIALIZE(): this { | ||
switch (<u32>keyEnd - <u32>keyStart) { | ||
case 6: { | ||
const code48 = load<u64>(keyStart) & 281474976710655; | ||
if (code48 == 493928513648) { | ||
store<usize>(changetype<usize>(out), 0, offsetof<this>("pos")); | ||
case 20: { | ||
const codeS8 = load<u64>(keyStart, 0); | ||
const codeS16 = load<u64>(keyStart, 8); | ||
const codeS20 = load<u32>(keyStart, 16); | ||
if (codeS8 == 32370111954878566 && codeS16 == 27303545189433460 && codeS20 == 6619245) { | ||
store<usize>(changetype<usize>(out), 0, offsetof<this>("firstName")); | ||
srcStart += 2; | ||
@@ -582,8 +572,6 @@ keyStart = 0; | ||
case 20: { | ||
const codeS8 = load<u64>(keyStart, 0); | ||
const codeS16 = load<u64>(keyStart, 8); | ||
const codeS20 = load<u32>(keyStart, 16); | ||
if (codeS8 == 32370111954878566 && codeS16 == 27303545189433460 && codeS20 == 6619245) { | ||
store<usize>(changetype<usize>(out), 0, offsetof<this>("firstName")); | ||
case 6: { | ||
const code48 = load<u64>(keyStart) & 281474976710655; | ||
if (code48 == 493928513648) { | ||
store<usize>(changetype<usize>(out), 0, offsetof<this>("pos")); | ||
srcStart += 2; | ||
@@ -590,0 +578,0 @@ keyStart = 0; |
@@ -1,4 +0,2 @@ | ||
import { JSON } from "."; | ||
@json | ||
@@ -23,4 +21,2 @@ class Vec3 { | ||
@omitnull() | ||
pos!: Vec3 | null; | ||
@@ -27,0 +23,0 @@ isVerified!: boolean; |
# Change Log | ||
## 2025-06-30 - 1.1.18 | ||
- fix: [#150](https://github.com/JairusSW/json-as/issues/150) | ||
## 2025-06-17 - 1.1.17 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "json-as", | ||
"version": "1.1.17", | ||
"version": "1.1.18", | ||
"author": "Jairus Tanaka", | ||
@@ -12,6 +12,6 @@ "repository": { | ||
"@assemblyscript/wasi-shim": "^0.1.0", | ||
"@types/node": "^22.15.32", | ||
"@types/node": "^22.15.34", | ||
"assemblyscript": "^0.28.2", | ||
"assemblyscript-prettier": "^3.0.1", | ||
"prettier": "^3.5.3", | ||
"prettier": "^3.6.2", | ||
"tsx": "^4.20.3", | ||
@@ -61,3 +61,3 @@ "typescript": "^5.8.3" | ||
"bench:js": "bash ./run-bench.js.sh", | ||
"build:test": "rm -rf ./build/ && set JSON_DEBUG=1 && set JSON_WRITE=assembly/test.ts && asc assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json", | ||
"build:test": "rm -rf ./build/ && JSON_DEBUG=1 JSON_WRITE=assembly/test.ts asc assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json", | ||
"build:test:wine": "JSON_DEBUG=1 JSON_WRITE=assembly/test.ts NODE_SKIP_PLATFORM_CHECK=1 wine ~/.win-bin/node/node.exe ./node_modules/assemblyscript/bin/asc.js assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json", | ||
@@ -64,0 +64,0 @@ "test:wasmtime": "wasmtime ./build/test.wasm", |
@@ -9,3 +9,3 @@ <h6 align="center"> | ||
</span> | ||
AssemblyScript - v1.1.17 | ||
AssemblyScript - v1.1.18 | ||
</pre> | ||
@@ -12,0 +12,0 @@ </h6> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
700238
0.09%12581
-0.09%