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 ;
@@ -314,8 +315,9 @@ export class Decoder {
314315 // arrays and maps
315316 const state = stack [ stack . length - 1 ] ;
316317 if ( state . type === State . ARRAY ) {
317- state . array . push ( object ) ;
318- if ( state . array . length === state . size ) {
318+ state . array [ state . position ] = object ;
319+ state . position ++ ;
320+ if ( state . position === state . size ) {
319321 stack . pop ( ) ;
320322 object = state . array ;
321323 } else {
@@ -383,7 +385,8 @@ export class Decoder {
383385 this . stack . push ( {
384386 type : State . ARRAY ,
385387 size,
386- array : [ ] ,
388+ array : new Array < unknown > ( size ) ,
389+ position : 0 ,
387390 } ) ;
388391 }
389392
You can’t perform that action at this time.
0 commit comments