Skip to content

Commit

Permalink
fix: check if a static method is already set (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
darind authored Jul 25, 2021
1 parent b4239fa commit 1f40861
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions NativeScript/runtime/MetadataBuilder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,10 @@

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

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

names.emplace(methodName, 0);
}
Expand Down

0 comments on commit 1f40861

Please sign in to comment.