| 940 | callContext.getExceptionTracker().onError("Value is not a function"); |
| 941 | return newUndefined(); |
| 942 | } |
| 943 | |
| 944 | auto handle = hermes::vm::Handle<hermes::vm::Callable>::vmcast(hermesValue); |
| 945 | |
| 946 | auto thisValue = toHermesValue(callContext.getThisValue()); |
| 947 | hermes::vm::ScopedNativeCallFrame callFrame(*_runtime, |
| 948 | static_cast<uint32_t>(callContext.getParameterSize()), |
| 949 | handle.getHermesValue(), |
| 950 | hermes::vm::HermesValue::encodeUndefinedValue(), |
| 951 | thisValue.isUndefined() ? _runtime->getGlobal().getHermesValue() : |
| 952 | thisValue); |
| 953 | |
| 954 | auto callResult = doCall(callFrame, handle, callContext); |
| 955 | |
| 956 | if (!checkException(callResult.getStatus(), callContext.getExceptionTracker())) { |
| 957 | return newUndefined(); |
| 958 | } |
| 959 | |
| 960 | return toJSValueRef(callResult->get()); |
| 961 | } |
| 962 | |
| 963 | JSValueRef HermesJavaScriptContext::callObjectAsConstructor(const JSValue& object, JSFunctionCallContext& callContext) { |
| 964 | hermes::vm::GCScope gcScope(*_runtime); |
| 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"); |