diff options
author | 2023-07-11 12:48:19 -0700 | |
---|---|---|
committer | 2023-07-11 12:48:19 -0700 | |
commit | 31ab56d36238528c6f44c52a6cbf600744a91f0a (patch) | |
tree | 262d70003271800a6c2c7e9c72316ae82d037986 /src/bun.js/bindings/bindings.cpp | |
parent | 4b333b2d3571a106e8a028ce62bf5149954d38f0 (diff) | |
download | bun-31ab56d36238528c6f44c52a6cbf600744a91f0a.tar.gz bun-31ab56d36238528c6f44c52a6cbf600744a91f0a.tar.zst bun-31ab56d36238528c6f44c52a6cbf600744a91f0a.zip |
Fix: console.log with class constructors (#3602)
* Fix console.log with class constructors
* oops
* fix it
* lol
* fix test
Diffstat (limited to 'src/bun.js/bindings/bindings.cpp')
-rw-r--r-- | src/bun.js/bindings/bindings.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 9f9b20c1e..d311072e4 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -2775,8 +2775,18 @@ void JSC__JSValue__put(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, const Z bool JSC__JSValue__isClass(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1) { - JSC::JSValue value = JSC::JSValue::decode(JSValue0); - return value.isConstructor(); + JSValue value = JSValue::decode(JSValue0); + auto callData = getCallData(value); + + switch (callData.type) { + case CallData::Type::JS: + return callData.js.functionExecutable->isClassConstructorFunction(); + case CallData::Type::Native: + if (callData.native.isBoundFunction) + return false; + return value.isConstructor(); + } + return false; } bool JSC__JSValue__isCell(JSC__JSValue JSValue0) { return JSC::JSValue::decode(JSValue0).isCell(); } bool JSC__JSValue__isCustomGetterSetter(JSC__JSValue JSValue0) |