Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Addressed PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Mar 7, 2018
1 parent bd9e8b6 commit c3eafed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/mbgl/style/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class NotHasIdentifierFilter {

class ExpressionFilter {
public:
std::shared_ptr<expression::Expression> expression;
std::shared_ptr<const expression::Expression> expression;

friend bool operator==(const ExpressionFilter& lhs, const ExpressionFilter& rhs) {
return *(lhs.expression) == *(rhs.expression);
Expand Down Expand Up @@ -274,7 +274,7 @@ using FilterBase = variant<
class Filter : public FilterBase {
public:
using FilterBase::FilterBase;
bool operator()(expression::EvaluationContext context) const;
bool operator()(const expression::EvaluationContext &context) const;
};

} // namespace style
Expand Down
10 changes: 7 additions & 3 deletions src/mbgl/style/conversion/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ static bool isExpressionFilter(const Convertible& filter) {

optional<std::string> op = toString(arrayMember(filter, 0));

if (*op == "has") {
auto operand = toString(arrayMember(filter, 1));
return arrayLength(filter) >= 2 && operand && *operand != "$id" && *operand != "$type";
if (!op) {
return false;

} else if (*op == "has") {
if (arrayLength(filter) < 2) return false;
optional<std::string> operand = toString(arrayMember(filter, 1));
return operand && *operand != "$id" && *operand != "$type";

} else if (*op == "in" || *op == "!in" || *op == "!has" || *op == "none") {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/style/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace mbgl {
namespace style {

bool Filter::operator()(expression::EvaluationContext context) const {
bool Filter::operator()(const expression::EvaluationContext &context) const {
return FilterBase::visit(*this, FilterEvaluator { context });
}

Expand Down

0 comments on commit c3eafed

Please sign in to comment.