@@ -3,7 +3,7 @@ import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec";
33import { getInt64 , getUint64 } from "./utils/int" ;
44import { utf8DecodeJs , TEXT_ENCODING_AVAILABLE , TEXT_DECODER_THRESHOLD , utf8DecodeTD } from "./utils/utf8" ;
55import { createDataView , ensureUint8Array } from "./utils/typedArrays" ;
6- import { CachedKeyDecoder } from "./CachedKeyDecoder" ;
6+ import { CachedKeyDecoder , KeyDecoder } from "./CachedKeyDecoder" ;
77
88const enum State {
99 ARRAY ,
@@ -77,7 +77,7 @@ export class Decoder<ContextType> {
7777 readonly maxArrayLength = DEFAULT_MAX_LENGTH ,
7878 readonly maxMapLength = DEFAULT_MAX_LENGTH ,
7979 readonly maxExtLength = DEFAULT_MAX_LENGTH ,
80- readonly cachedKeyDecoder : CachedKeyDecoder | null = sharedCachedKeyDecoder ,
80+ readonly keyDecoder : KeyDecoder | null = sharedCachedKeyDecoder ,
8181 ) { }
8282
8383 private reinitializeState ( ) {
@@ -494,8 +494,8 @@ export class Decoder<ContextType> {
494494
495495 const offset = this . pos + headerOffset ;
496496 let object : string ;
497- if ( this . stateIsMapKey ( ) && this . cachedKeyDecoder ?. canBeCached ( byteLength ) ) {
498- object = this . cachedKeyDecoder . decode ( this . bytes , offset , byteLength ) ;
497+ if ( this . stateIsMapKey ( ) && this . keyDecoder ?. canBeCached ( byteLength ) ) {
498+ object = this . keyDecoder . decode ( this . bytes , offset , byteLength ) ;
499499 } else if ( TEXT_ENCODING_AVAILABLE && byteLength > TEXT_DECODER_THRESHOLD ) {
500500 object = utf8DecodeTD ( this . bytes , offset , byteLength ) ;
501501 } else {
0 commit comments