(obj, ctx, recurseTimes, protoProps)
| 906 | .set(WeakSetPrototype, { name: 'WeakSet', constructor: WeakSet }); |
| 907 | |
| 908 | function getConstructorName(obj, ctx, recurseTimes, protoProps) { |
| 909 | let firstProto; |
| 910 | const tmp = obj; |
| 911 | while (obj || isUndetectableObject(obj)) { |
| 912 | const wellKnownPrototypeNameAndConstructor = wellKnownPrototypes.get(obj); |
| 913 | if (wellKnownPrototypeNameAndConstructor !== undefined) { |
| 914 | const { name, constructor } = wellKnownPrototypeNameAndConstructor; |
| 915 | if (FunctionPrototypeSymbolHasInstance(constructor, tmp)) { |
| 916 | if (protoProps !== undefined && firstProto !== obj) { |
| 917 | addPrototypeProperties( |
| 918 | ctx, tmp, firstProto || tmp, recurseTimes, protoProps); |
| 919 | } |
| 920 | return name; |
| 921 | } |
| 922 | } |
| 923 | const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor'); |
| 924 | if (descriptor !== undefined && |
| 925 | typeof descriptor.value === 'function' && |
| 926 | descriptor.value.name !== '' && |
| 927 | isInstanceof(tmp, descriptor.value)) { |
| 928 | if (protoProps !== undefined && |
| 929 | (firstProto !== obj || |
| 930 | !builtInObjects.has(descriptor.value.name))) { |
| 931 | addPrototypeProperties( |
| 932 | ctx, tmp, firstProto || tmp, recurseTimes, protoProps); |
| 933 | } |
| 934 | return String(descriptor.value.name); |
| 935 | } |
| 936 | |
| 937 | obj = ObjectGetPrototypeOf(obj); |
| 938 | if (firstProto === undefined) { |
| 939 | firstProto = obj; |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | if (firstProto === null) { |
| 944 | return null; |
| 945 | } |
| 946 | |
| 947 | const res = internalGetConstructorName(tmp); |
| 948 | |
| 949 | if (recurseTimes > ctx.depth && ctx.depth !== null) { |
| 950 | return `${res} <Complex prototype>`; |
| 951 | } |
| 952 | |
| 953 | const protoConstr = getConstructorName( |
| 954 | firstProto, ctx, recurseTimes + 1, protoProps); |
| 955 | |
| 956 | if (protoConstr === null) { |
| 957 | return `${res} <${inspect(firstProto, { |
| 958 | ...ctx, |
| 959 | customInspect: false, |
| 960 | depth: -1, |
| 961 | })}>`; |
| 962 | } |
| 963 | |
| 964 | return `${res} <${protoConstr}>`; |
| 965 | } |
no test coverage detected
searching dependent graphs…