| 965 | const auto* hermesValue = toPinnedHermesValue(object); |
| 966 | |
| 967 | if (!hermes::vm::vmisa<hermes::vm::Callable>(*hermesValue)) { |
| 968 | callContext.getExceptionTracker().onError("Value is not a function"); |
| 969 | return newUndefined(); |
| 970 | } |
| 971 | |
| 972 | auto handle = hermes::vm::Handle<hermes::vm::Callable>::vmcast(hermesValue); |
| 973 | |
| 974 | auto thisRes = hermes::vm::Callable::createThisForConstruct_RJS(handle, *_runtime); |
| 975 | auto objHandle = _runtime->makeHandle<hermes::vm::JSObject>(std::move(*thisRes)); |
| 976 | |
| 977 | hermes::vm::ScopedNativeCallFrame callFrame(*_runtime, |
| 978 | static_cast<uint32_t>(callContext.getParameterSize()), |
| 979 | handle.getHermesValue(), |
| 980 | handle.getHermesValue(), |
| 981 | objHandle.getHermesValue()); |
| 982 | |
| 983 | auto callResult = doCall(callFrame, handle, callContext); |
| 984 | |
| 985 | if (!checkException(callResult.getStatus(), callContext.getExceptionTracker())) { |
| 986 | return newUndefined(); |
| 987 | } |
| 988 | |
| 989 | auto resultValue = callResult->get(); |
| 990 | return toJSValueRef(resultValue.isObject() ? resultValue : objHandle.getHermesValue()); |
| 991 | } |
| 992 | |
| 993 | void HermesJavaScriptContext::visitObjectPropertyNames(const JSValue& object, |
| 994 | JSExceptionTracker& exceptionTracker, |
| 995 | IJavaScriptPropertyNamesVisitor& visitor) { |
| 996 | hermes::vm::GCScope gcScope(*_runtime); |
| 997 | auto jsObject = toJSObject(object, exceptionTracker); |
| 998 | if (!jsObject) { |
| 999 | return; |
| 1000 | } |
| 1001 |
nothing calls this directly
no test coverage detected