@@ -40,18 +40,18 @@ namespace ts {
40
40
41
41
type Recurser = < T > ( obj : unknown , name : string , cbOk : ( ) => T , cbFail : ( isCircularReference : boolean , keyStack : ReadonlyArray < string > ) => T ) => T ;
42
42
function getRecurser ( ) : Recurser {
43
- const seen = new Set < unknown > ( ) ;
43
+ const seen : unknown [ ] = [ ] ;
44
44
const nameStack : string [ ] = [ ] ;
45
45
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 ) ;
48
48
}
49
49
50
- seen . add ( obj ) ;
50
+ seen . push ( obj ) ;
51
51
nameStack . push ( name ) ;
52
52
const res = cbOk ( ) ;
53
53
nameStack . pop ( ) ;
54
- seen . delete ( obj ) ;
54
+ seen . pop ( ) ;
55
55
return res ;
56
56
} ;
57
57
}
@@ -104,8 +104,8 @@ namespace ts {
104
104
key === "constructor" ? undefined : getValueInfo ( key , value , recurser ) ) ;
105
105
}
106
106
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 ) ;
109
109
interface ObjectEntry { readonly key : string ; readonly value : unknown ; }
110
110
function getEntriesOfObject ( obj : object ) : ReadonlyArray < ObjectEntry > {
111
111
const seen = createMap < true > ( ) ;
@@ -114,8 +114,8 @@ namespace ts {
114
114
while ( ! isNullOrUndefined ( chain ) && chain !== Object . prototype && chain !== Function . prototype ) {
115
115
for ( const key of Object . getOwnPropertyNames ( chain ) ) {
116
116
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 ) &&
119
119
// Don't add property from a higher prototype if it already exists in a lower one
120
120
addToSeen ( seen , key ) ) {
121
121
const value = safeGetPropertyOfObject ( chain , key ) ;
0 commit comments