Skip to content

Commit adcfe5a

Browse files
committed
chore: rename static objects to struct
1 parent 45f2a39 commit adcfe5a

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

assembly/deserialize/simple/arbitrary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { JSON } from "../..";
22
import { deserializeArray } from "./array";
33
import { deserializeBoolean } from "./bool";
44
import { deserializeFloat } from "./float";
5-
import { deserializeObject } from "./object";
5+
import { deserializeStruct } from "./struct";
66
import { deserializeString } from "./string";
77

88
export function deserializeArbitrary(srcStart: usize, srcEnd: usize, dst: usize): JSON.Value {
99
const firstChar = load<u16>(srcStart);
1010
if (firstChar == 34) return JSON.Value.from(deserializeString(srcStart, srcEnd, dst));
11-
else if (firstChar == 123) return JSON.Value.from(deserializeObject(srcStart, srcEnd, dst));
11+
else if (firstChar == 123) return JSON.Value.from(deserializeStruct(srcStart, srcEnd, dst));
1212
else if (firstChar - 48 <= 9 || firstChar == 45) return JSON.Value.from(deserializeFloat<f64>(srcStart, srcEnd));
1313
else if (firstChar == 91) {
1414
return JSON.Value.from(deserializeArray<JSON.Value[]>(srcStart, srcEnd, dst));

assembly/deserialize/simple/array.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { deserializeBooleanArray } from "./array/bool";
55
import { deserializeFloatArray } from "./array/float";
66
import { deserializeIntegerArray } from "./array/integer";
77
import { deserializeMapArray } from "./array/map";
8-
import { deserializeObjectArray } from "./array/object";
8+
import { deserializeStructArray } from "./array/struct";
99
import { deserializeStringArray } from "./array/string";
1010

1111
// @ts-ignore: Decorator valid here
@@ -34,7 +34,7 @@ export function deserializeArray<T extends unknown[]>(srcStart: usize, srcEnd: u
3434
return deserializeMapArray<T>(srcStart, srcEnd, dst);
3535
// @ts-ignore: defined by transform
3636
} else if (isDefined(type.__DESERIALIZE)) {
37-
return deserializeObjectArray<T>(srcStart, srcEnd, dst);
37+
return deserializeStructArray<T>(srcStart, srcEnd, dst);
3838
}
3939
throw new Error("Could not parse array of type " + nameof<T>() + "!");
4040
} else {

assembly/deserialize/simple/array/object.ts renamed to assembly/deserialize/simple/array/struct.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BRACE_LEFT, BRACE_RIGHT } from "../../../custom/chars";
22
import { JSON } from "../../..";
33

4-
export function deserializeObjectArray<T extends unknown[]>(srcStart: usize, srcEnd: usize, dst: usize): T {
4+
export function deserializeStructArray<T extends unknown[]>(srcStart: usize, srcEnd: usize, dst: usize): T {
55
const out = dst ? changetype<T>(dst) : instantiate<T>();
66
let lastIndex: usize = 0;
77
let depth: u32 = 0;
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { JSON } from "../..";
21
import { BACK_SLASH, COMMA, CHAR_F, BRACE_LEFT, BRACKET_LEFT, CHAR_N, QUOTE, BRACE_RIGHT, BRACKET_RIGHT, CHAR_T } from "../../custom/chars";
32
import { isSpace } from "../../util";
4-
import { ptrToStr } from "../../util/ptrToStr";
53

6-
export function deserializeObject<T>(srcStart: usize, srcEnd: usize, dst: usize): T {
4+
export function deserializeStruct<T>(srcStart: usize, srcEnd: usize, dst: usize): T {
75
const out = changetype<nonnull<T>>(dst || __new(offsetof<T>(), idof<T>()));
86

97
let keyStart: usize = 0;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ interface GeneratedInterface {
22
__SERIALIZE(ptr: usize): string;
33
}
44

5-
export function serializeObject<T extends GeneratedInterface>(data: T): void {
5+
export function serializeStruct<T extends GeneratedInterface>(data: T): void {
66
changetype<nonnull<T>>(data).__SERIALIZE(changetype<usize>(data));
77
}

0 commit comments

Comments
 (0)