fix unit filter always evaluating [and] even if it is not needed.

This commit is contained in:
gfgtdf 2018-05-28 17:32:58 +02:00 committed by GitHub
parent 9c30032ab4
commit 7be39c937d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -244,17 +244,15 @@ bool unit_filter_compound::matches(const unit_filter_args& args) const
// Handle [and], [or], and [not] with in-order precedence
for(const auto & filter : cond_children_) {
bool child_res = filter.second.matches(args);
switch (filter.first.v) {
case CONDITIONAL_TYPE::AND:
res = res && child_res;
res = res && filter.second.matches(args);
break;
case CONDITIONAL_TYPE::OR:
res = res || child_res;
res = res || filter.second.matches(args);
break;
case CONDITIONAL_TYPE::NOT:
res = res && !child_res;
res = res && !filter.second.matches(args);
break;
}
}