1
0
Fork 0

fix call/apply

This commit is contained in:
jsteemann 2018-05-29 22:07:37 +02:00
parent 83b22aee44
commit f5d7053bb1
1 changed files with 11 additions and 9 deletions

View File

@ -6791,11 +6791,21 @@ AqlValue Functions::Apply(
SmallVector<AqlValue>::allocator_type::arena_type arena;
VPackFunctionParameters invokeParams{arena};
AqlValue rawParamArray;
std::vector<bool> mustFree;
auto guard = scopeGuard([&mustFree, &invokeParams]() {
for (size_t i = 0; i < mustFree.size(); ++i) {
if (mustFree[i]) {
invokeParams[i].destroy();
}
}
});
if (parameters.size() == 2) {
// We have a parameter that should be an array, whichs content we need to make
// the sub functions parameters.
AqlValue rawParamArray = ExtractFunctionParameterValue(parameters, 1);
rawParamArray = ExtractFunctionParameterValue(parameters, 1);
if (!rawParamArray.isArray()) {
::registerWarning(query, AFN, TRI_ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
@ -6811,14 +6821,6 @@ AqlValue Functions::Apply(
}
}
auto guard = scopeGuard([&mustFree, &invokeParams]() {
for (size_t i = 0; i < mustFree.size(); ++i) {
if (mustFree[i]) {
invokeParams[i].destroy();
}
}
});
return CallApplyBackend(query, trx, parameters, AFN, invokeFN, invokeParams);
}