Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -29,7 +29,9 @@ bool isSearchableRuntimeType(const type::Type& type) {
} // namespace
In::In(std::unique_ptr<Expression> needle_, std::unique_ptr<Expression> haystack_)
: Expression(Kind::In, type::Boolean), needle(std::move(needle_)), haystack(std::move(haystack_)) {
: Expression(Kind::In, type::Boolean),
needle(std::move(needle_)),
haystack(std::move(haystack_)) {
assert(isComparableType(needle->getType()));
assert(isSearchableType(haystack->getType()));
}
@@ -47,14 +49,18 @@ EvaluationResult In::evaluate(const EvaluationContext& params) const {
type::Type evaluatedNeedleType = typeOf(*evaluatedNeedle);
if (!isComparableRuntimeType(evaluatedNeedleType)) {
return EvaluationError{"Expected first argument to be of type boolean, string or number, but found " +
toString(evaluatedNeedleType) + " instead."};
return EvaluationError{
"Expected first argument to be of type boolean, string or number, "
"but found " +
toString(evaluatedNeedleType) + " instead."};
}
type::Type evaluatedHaystackType = typeOf(*evaluatedHaystack);
if (!isSearchableRuntimeType(evaluatedHaystackType)) {
return EvaluationError{"Expected second argument to be of type array or string, but found " +
toString(evaluatedHaystackType) + " instead."};
return EvaluationError{
"Expected second argument to be of type array or string, but "
"found " +
toString(evaluatedHaystackType) + " instead."};
}
if (evaluatedNeedleType == type::Null || evaluatedHaystackType == type::Null) {
@@ -97,14 +103,18 @@ ParseResult In::parse(const Convertible& value, ParsingContext& ctx) {
type::Type haystackType = (*haystack)->getType();
if (!isComparableType(needleType)) {
ctx.error("Expected first argument to be of type boolean, string or number, but found " + toString(needleType) +
" instead.");
ctx.error(
"Expected first argument to be of type boolean, string or number, "
"but found " +
toString(needleType) + " instead.");
return ParseResult();
}
if (!isSearchableType(haystackType)) {
ctx.error("Expected second argument to be of type array or string, but found " + toString(haystackType) +
" instead.");
ctx.error(
"Expected second argument to be of type array or string, but "
"found " +
toString(haystackType) + " instead.");
return ParseResult();
}
return ParseResult(std::make_unique<In>(std::move(*needle), std::move(*haystack)));