Skip to content

Commit 1f40861

Browse files
authored
fix: check if a static method is already set (#122)
1 parent b4239fa commit 1f40861

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

NativeScript/runtime/MetadataBuilder.mm

+4-2
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,10 @@
526526

527527
DefineFunctionLengthProperty(context, methodMeta->encodings(), staticMethod);
528528

529-
bool success = ctorFunc->Set(context, tns::ToV8String(isolate, methodMeta->jsName()), staticMethod).FromMaybe(false);
530-
tns::Assert(success, isolate);
529+
if (!ctorFunc->Has(context, tns::ToV8String(isolate, methodMeta->jsName())).FromJust()) {
530+
bool success = ctorFunc->Set(context, tns::ToV8String(isolate, methodMeta->jsName()), staticMethod).FromMaybe(false);
531+
tns::Assert(success, isolate);
532+
}
531533

532534
names.emplace(methodName, 0);
533535
}

0 commit comments

Comments
 (0)