diff options
Diffstat (limited to 'include/mbgl/style/expression/let.hpp')
-rw-r--r-- | include/mbgl/style/expression/let.hpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/mbgl/style/expression/let.hpp b/include/mbgl/style/expression/let.hpp index d0210d8bba..d11ba1b976 100644 --- a/include/mbgl/style/expression/let.hpp +++ b/include/mbgl/style/expression/let.hpp @@ -16,7 +16,7 @@ public: using Bindings = std::map<std::string, std::shared_ptr<Expression>>; Let(Bindings bindings_, std::unique_ptr<Expression> result_) : - Expression(result_->getType()), + Expression(Kind::Let, result_->getType()), bindings(std::move(bindings_)), result(std::move(result_)) {} @@ -27,7 +27,8 @@ public: void eachChild(const std::function<void(const Expression&)>&) const override; bool operator==(const Expression& e) const override { - if (auto rhs = dynamic_cast<const Let*>(&e)) { + if (e.getKind() == Kind::Let) { + auto rhs = static_cast<const Let*>(&e); return *result == *(rhs->result); } return false; @@ -49,7 +50,7 @@ private: class Var : public Expression { public: Var(std::string name_, std::shared_ptr<Expression> value_) : - Expression(value_->getType()), + Expression(Kind::Var, value_->getType()), name(std::move(name_)), value(value_) {} @@ -60,7 +61,8 @@ public: void eachChild(const std::function<void(const Expression&)>&) const override; bool operator==(const Expression& e) const override { - if (auto rhs = dynamic_cast<const Var*>(&e)) { + if (e.getKind() == Kind::Var) { + auto rhs = static_cast<const Var*>(&e); return *value == *(rhs->value); } return false; |