File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ type StackMapState = {
75
75
size : number ;
76
76
key : MapKeyType | null ;
77
77
readCount : number ;
78
- map : Array < { key : MapKeyType , value : unknown } > ;
78
+ map : Array < { key : MapKeyType ; value : unknown } > | Record < string , unknown > ;
79
79
} ;
80
80
81
81
type StackArrayState = {
@@ -112,7 +112,12 @@ class StackPool {
112
112
state . type = STATE_MAP_KEY ;
113
113
state . readCount = 0 ;
114
114
state . size = size ;
115
- state . map = [ ] ;
115
+
116
+ if ( this . stackHeadPosition === 0 ) {
117
+ state . map = [ ] ;
118
+ } else {
119
+ state . map = { } ;
120
+ }
116
121
}
117
122
118
123
private getUninitializedStateFromPool ( ) {
@@ -572,7 +577,12 @@ export class Decoder<ContextType = undefined> {
572
577
} else {
573
578
// it must be `state.type === State.MAP_VALUE` here
574
579
575
- state . map . push ( { key : state . key ! , value : object } ) ;
580
+ if ( Array . isArray ( state . map ) ) {
581
+ state . map . push ( { key : state . key ! , value : object } ) ;
582
+ } else {
583
+ state . map [ state . key ! ] = object ;
584
+ }
585
+
576
586
state . readCount ++ ;
577
587
578
588
if ( state . readCount === state . size ) {
You can’t perform that action at this time.
0 commit comments