Dump array length in ClassArray_fromBinary()
This commit is contained in:
@@ -11,6 +11,12 @@ abstract class ClassArray<T> extends Serializable<T> {
|
||||
|
||||
_fromBinary(buffer: UhkBuffer): Serializable<T> {
|
||||
let arrayLength = buffer.readCompactLength();
|
||||
|
||||
if (buffer.enableDump) {
|
||||
process.stdout.write(']\n');
|
||||
buffer.enableDump = false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < arrayLength; i++) {
|
||||
this.elements.push(this.binaryToClass(buffer));
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ abstract class Serializable<T> {
|
||||
fromBinary(buffer: UhkBuffer): Serializable<T> {
|
||||
let indentation = new Array(Serializable.depth + 1).join(' ');
|
||||
let isArray = this instanceof ClassArray;
|
||||
process.stdout.write(`${indentation}${this.constructor.name}.fromBinary:` + (isArray ? '\n' : ' ['));
|
||||
process.stdout.write(`${indentation}${this.constructor.name}.fromBinary: [`);
|
||||
Serializable.depth++;
|
||||
buffer.enableDump = !isArray;
|
||||
buffer.enableDump = true;
|
||||
let value = this._fromBinary(buffer);
|
||||
buffer.enableDump = false;
|
||||
Serializable.depth--;
|
||||
|
||||
Reference in New Issue
Block a user