Skip to content

Commit 6003b7d

Browse files
committed
pass tests
1 parent 5111abd commit 6003b7d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

assembly/deserialize/simple/bool.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CHAR_F, CHAR_T } from "../../custom/chars";
33
export function deserializeBoolean(srcStart: usize, srcEnd: usize): boolean {
44
const srcSize = srcEnd - srcStart;
55
const firstChar = load<u16>(srcStart);
6-
if (srcSize == 4 && firstChar == CHAR_T && load<u64>(srcStart) == 28429475166421108) return true;
7-
else if (srcSize == 5 && firstChar == CHAR_F && load<u64>(srcSize, 2) == 28429466576093281) return false;
6+
if (firstChar == CHAR_T && load<u64>(srcStart) == 28429475166421108) return true;
7+
else if (firstChar == CHAR_F && load<u64>(srcSize, 2) == 28429466576093281) return false;
88
return false; //ERROR(`Expected to find boolean, but found "${data.slice(0, 100)}" instead!`);
9-
}
9+
}

assembly/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export namespace JSON {
4848
* @returns string
4949
*/
5050
export function stringify<T>(data: T, out: string | null = null): string {
51-
if (isBoolean<T>(data)) {
51+
if (isBoolean<T>()) {
5252
if (out) {
5353
if (<bool>data == true) {
5454
out = changetype<string>(__renew(changetype<usize>(out), 8));
@@ -60,7 +60,7 @@ export namespace JSON {
6060
}
6161
return out;
6262
}
63-
return out ? "true" : "false";
63+
return data ? "true" : "false";
6464
} else if (isInteger<T>() && nameof<T>() == "usize" && data == 0) {
6565
if (out) {
6666
out = changetype<string>(__renew(changetype<usize>(out), 8));

0 commit comments

Comments
 (0)