diff --git a/assembly/deserialize/simple/array/float.ts b/assembly/deserialize/simple/array/float.ts index 9b06e6d..3166a2b 100644 --- a/assembly/deserialize/simple/array/float.ts +++ b/assembly/deserialize/simple/array/float.ts @@ -1,9 +1,9 @@ import { isSpace } from "../../../util"; -import { COMMA, BRACE_RIGHT } from "../../../custom/chars"; +import { COMMA, BRACE_RIGHT, BRACKET_RIGHT } from "../../../custom/chars"; import { JSON } from "../../.."; export function deserializeFloatArray(srcStart: usize, srcEnd: usize, dst: usize): T { - const out = changetype(dst); + const out = changetype(dst || __new(offsetof(), idof())); let lastIndex: usize = 0; while (srcStart < srcEnd) { const code = load(srcStart); @@ -12,7 +12,7 @@ export function deserializeFloatArray(srcStart: usize, srcEn srcStart += 2; while (srcStart < srcEnd) { const code = load(srcStart); - if (code == COMMA || code == BRACE_RIGHT || isSpace(code)) { + if (code == COMMA || code == BRACKET_RIGHT || isSpace(code)) { out.push(JSON.__deserialize>(lastIndex, srcStart)); // while (isSpace(load((srcStart += 2)))) { // /* empty */ diff --git a/assembly/deserialize/simple/array/integer.ts b/assembly/deserialize/simple/array/integer.ts index 42eedb9..1321c02 100644 --- a/assembly/deserialize/simple/array/integer.ts +++ b/assembly/deserialize/simple/array/integer.ts @@ -1,9 +1,10 @@ import { isSpace } from "../../../util"; -import { COMMA, BRACE_RIGHT } from "../../../custom/chars"; +import { COMMA, BRACE_RIGHT, BRACKET_RIGHT } from "../../../custom/chars"; import { JSON } from "../../.."; +import { ptrToStr } from "../../../util/ptrToStr"; export function deserializeIntegerArray(srcStart: usize, srcEnd: usize, dst: usize): T { - const out = changetype(dst); + const out = changetype(dst || __new(offsetof(), idof())); let lastIndex: usize = 0; while (srcStart < srcEnd) { const code = load(srcStart); @@ -12,8 +13,9 @@ export function deserializeIntegerArray(srcStart: usize, src srcStart += 2; while (srcStart < srcEnd) { const code = load(srcStart); - if (code == COMMA || code == BRACE_RIGHT || isSpace(code)) { - out.push(JSON.__deserialize>(lastIndex, srcStart)); + if (code == COMMA || code == BRACKET_RIGHT || isSpace(code)) { + console.log("element: " + ptrToStr(lastIndex, srcStart)) + // out.push(JSON.__deserialize>(lastIndex, srcStart)); // while (isSpace(load((srcStart += 2)))) { // /* empty */ // }