| 855 | } |
| 856 | |
| 857 | void 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 | |
| 875 | void MetadataNode::InnerTypeAccessorGetterCallback(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 876 | v8::Isolate* isolate = info.GetIsolate(); |
nothing calls this directly
no test coverage detected