@@ -40,18 +40,18 @@ namespace ts {
4040
4141 type Recurser = < T > ( obj : unknown , name : string , cbOk : ( ) => T , cbFail : ( isCircularReference : boolean , keyStack : ReadonlyArray < string > ) => T ) => T ;
4242 function getRecurser ( ) : Recurser {
43- const seen = new Set < unknown > ( ) ;
43+ const seen : unknown [ ] = [ ] ;
4444 const nameStack : string [ ] = [ ] ;
4545 return ( obj , name , cbOk , cbFail ) => {
46- if ( seen . has ( obj ) || nameStack . length > 4 ) {
47- return cbFail ( seen . has ( obj ) , nameStack ) ;
46+ if ( seen . indexOf ( obj ) !== - 1 || nameStack . length > 4 ) {
47+ return cbFail ( seen . indexOf ( obj ) !== - 1 , nameStack ) ;
4848 }
4949
50- seen . add ( obj ) ;
50+ seen . push ( obj ) ;
5151 nameStack . push ( name ) ;
5252 const res = cbOk ( ) ;
5353 nameStack . pop ( ) ;
54- seen . delete ( obj ) ;
54+ seen . pop ( ) ;
5555 return res ;
5656 } ;
5757 }
@@ -104,8 +104,8 @@ namespace ts {
104104 key === "constructor" ? undefined : getValueInfo ( key , value , recurser ) ) ;
105105 }
106106
107- const ignoredProperties : ReadonlySet < string > = new Set ( [ "arguments" , "caller" , "constructor" , "eval" , "super_" ] ) ;
108- const reservedFunctionProperties : ReadonlySet < string > = new Set ( Object . getOwnPropertyNames ( noop ) ) ;
107+ const ignoredProperties : ReadonlyArray < string > = [ "arguments" , "caller" , "constructor" , "eval" , "super_" ] ;
108+ const reservedFunctionProperties : ReadonlyArray < string > = Object . getOwnPropertyNames ( noop ) ;
109109 interface ObjectEntry { readonly key : string ; readonly value : unknown ; }
110110 function getEntriesOfObject ( obj : object ) : ReadonlyArray < ObjectEntry > {
111111 const seen = createMap < true > ( ) ;
@@ -114,8 +114,8 @@ namespace ts {
114114 while ( ! isNullOrUndefined ( chain ) && chain !== Object . prototype && chain !== Function . prototype ) {
115115 for ( const key of Object . getOwnPropertyNames ( chain ) ) {
116116 if ( ! isJsPrivate ( key ) &&
117- ! ignoredProperties . has ( key ) &&
118- ( typeof obj !== "function" || ! reservedFunctionProperties . has ( key ) ) &&
117+ ignoredProperties . indexOf ( key ) === - 1 &&
118+ ( typeof obj !== "function" || reservedFunctionProperties . indexOf ( key ) === - 1 ) &&
119119 // Don't add property from a higher prototype if it already exists in a lower one
120120 addToSeen ( seen , key ) ) {
121121 const value = safeGetPropertyOfObject ( chain , key ) ;
0 commit comments