aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/bindings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/bindings.cpp')
-rw-r--r--src/bun.js/bindings/bindings.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 5c9cba7f0..d431a287f 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -3227,13 +3227,21 @@ void JSC__VM__releaseWeakRefs(JSC__VM* arg0)
static auto function_string_view = MAKE_STATIC_STRING_IMPL("Function");
void JSC__JSValue__getClassName(JSC__JSValue JSValue0, JSC__JSGlobalObject* arg1, ZigString* arg2)
{
- JSC::JSCell* cell = JSC::JSValue::decode(JSValue0).asCell();
+ JSValue value = JSValue::decode(JSValue0);
+ JSC::JSCell* cell = value.asCell();
if (cell == nullptr) {
arg2->len = 0;
return;
}
- const char* ptr = cell->className();
+ JSObject* obj = value.toObject(arg1);
+ StringView calculated = StringView(JSObject::calculatedClassName(obj));
+ if (calculated.length() > 0) {
+ *arg2 = Zig::toZigString(calculated);
+ return;
+ }
+
+ const char* ptr = cell->classInfo()->className;
auto view = WTF::StringView(ptr, strlen(ptr));
// Fallback to .name if className is empty
@@ -3784,6 +3792,12 @@ void JSC__JSValue__forEachPropertyOrdered(JSC__JSValue JSValue0, JSC__JSGlobalOb
}
}
+bool JSC__JSValue__isConstructor(JSC__JSValue JSValue0)
+{
+ JSValue value = JSValue::decode(JSValue0);
+ return value.isConstructor();
+}
+
extern "C" JSC__JSValue JSC__JSValue__createRopeString(JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject)
{
return JSValue::encode(JSC::jsString(globalObject, JSC::JSValue::decode(JSValue0).toString(globalObject), JSC::JSValue::decode(JSValue1).toString(globalObject)));