MCPcopy Create free account
hub / github.com/NativeScript/android / SetInnerTypes

Method SetInnerTypes

test-app/runtime/src/main/cpp/MetadataNode.cpp:857–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855}
856
857void MetadataNode::SetInnerTypes(v8::Isolate* isolate, Local<Function>& ctorFunction, MetadataTreeNode *treeNode) {
858 if (treeNode->children != nullptr) {
859 auto context = isolate->GetCurrentContext();
860 const auto &children = *treeNode->children;
861 for (auto curChild: children) {
862 bool hasOwnProperty = ctorFunction->HasOwnProperty(context, ArgConverter::ConvertToV8String(isolate, curChild->name)).ToChecked();
863 // Child is defined as a function already when the inner type is a companion object
864 if (!hasOwnProperty) {
865 ctorFunction->SetAccessor(
866 context,
867 v8::String::NewFromUtf8(isolate, curChild->name.c_str()).ToLocalChecked(),
868 InnerTypeAccessorGetterCallback, nullptr, v8::External::New(isolate, curChild)
869 );
870 }
871 }
872 }
873}
874
875void MetadataNode::InnerTypeAccessorGetterCallback(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
876 v8::Isolate* isolate = info.GetIsolate();

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
ToCheckedMethod · 0.80
ToLocalCheckedMethod · 0.80

Tested by

no test coverage detected