| 73 | : JSFunctionWithValueFunction(std::move(function), false, referenceInfo) {} |
| 74 | |
| 75 | JSValueRef JSFunctionWithUntypedValueFunction::doCall(const Ref<ValueFunction>& function, |
| 76 | const StringBox* precomputedFunctionIdentifier, |
| 77 | JSFunctionNativeCallContext& callContext) const { |
| 78 | auto referenceInfoBuilder = ReferenceInfoBuilder(getReferenceInfo()); |
| 79 | Valdi::SmallVector<Value, 8> outParameters; |
| 80 | { |
| 81 | VALDI_TRACE("Valdi.jsParametersToCpp"); |
| 82 | |
| 83 | for (size_t i = 0, size = callContext.getParameterSize(); i < size; i++) { |
| 84 | auto jsValue = callContext.getParameter(i); |
| 85 | |
| 86 | auto convertedParameterResult = jsValueToValue(callContext.getContext(), |
| 87 | jsValue, |
| 88 | referenceInfoBuilder.withParameter(i), |
| 89 | callContext.getExceptionTracker()); |
| 90 | if (!callContext.getExceptionTracker()) { |
| 91 | return callContext.getContext().newUndefined(); |
| 92 | } |
| 93 | |
| 94 | outParameters.emplace_back(std::move(convertedParameterResult)); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | ValueFunctionCallContext innerCallContext( |
| 99 | ValueFunctionFlagsNone, outParameters.data(), outParameters.size(), callContext.getExceptionTracker()); |
| 100 | innerCallContext.setFunctionIdentifier(precomputedFunctionIdentifier); |
| 101 | |
| 102 | auto outValue = (*function)(innerCallContext); |
| 103 | |
| 104 | VALDI_TRACE("Valdi.cppToJs"); |
| 105 | return valueToJSValue( |
| 106 | callContext.getContext(), outValue, referenceInfoBuilder.withReturnValue(), callContext.getExceptionTracker()); |
| 107 | } |
| 108 | |
| 109 | } // namespace Valdi |
nothing calls this directly
no test coverage detected