File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ type StackArrayState = {
2323 type : State . ARRAY ;
2424 size : number ;
2525 array : Array < unknown > ;
26+ position : number ;
2627} ;
2728
2829type StackState = StackArrayState | StackMapState ;
@@ -318,8 +319,9 @@ export class Decoder {
318319 // arrays and maps
319320 const state = stack [ stack . length - 1 ] ;
320321 if ( state . type === State . ARRAY ) {
321- state . array . push ( object ) ;
322- if ( state . array . length === state . size ) {
322+ state . array [ state . position ] = object ;
323+ state . position ++ ;
324+ if ( state . position === state . size ) {
323325 stack . pop ( ) ;
324326 object = state . array ;
325327 } else {
@@ -387,7 +389,8 @@ export class Decoder {
387389 this . stack . push ( {
388390 type : State . ARRAY ,
389391 size,
390- array : [ ] ,
392+ array : new Array < unknown > ( size ) ,
393+ position : 0 ,
391394 } ) ;
392395 }
393396
You can’t perform that action at this time.
0 commit comments