mirror of
https://github.com/fluencelabs/assemblyscript-json
synced 2025-04-26 15:22:23 +00:00
Minor fix to nested objects parsing
This commit is contained in:
parent
f3800cc7d7
commit
17d1fcf976
@ -105,6 +105,9 @@ export class JSONDecoder<JSONHandlerT extends JSONHandler> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private peekChar(): i32 {
|
private peekChar(): i32 {
|
||||||
|
if (this.state.readIndex >= this.state.buffer.length) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return this.state.buffer[this.state.readIndex];
|
return this.state.buffer[this.state.readIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +132,9 @@ export class JSONDecoder<JSONHandlerT extends JSONHandler> {
|
|||||||
if (this.peekChar() != "{".charCodeAt(0)) {
|
if (this.peekChar() != "{".charCodeAt(0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.handler.pushObject(this.state.lastKey)) {
|
let key = this.state.lastKey;
|
||||||
|
this.state.lastKey = null;
|
||||||
|
if (this.handler.pushObject(key)) {
|
||||||
this.readChar();
|
this.readChar();
|
||||||
this.skipWhitespace();
|
this.skipWhitespace();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user