diff --git a/src/Evaluator/EvalValues/EvalValue.hpp b/src/Evaluator/EvalValues/EvalValue.hpp index 249efe9..4912570 100644 --- a/src/Evaluator/EvalValues/EvalValue.hpp +++ b/src/Evaluator/EvalValues/EvalValue.hpp @@ -29,9 +29,7 @@ namespace Porygon::Evaluation { virtual bool operator==(const EvalValue *b) const = 0; [[nodiscard]] - virtual bool operator!=(const EvalValue *b) const { - return !(this->operator==(b)); - } + virtual bool operator!=(const EvalValue *b) const = 0; [[nodiscard]] virtual EvalValue* Clone() const = 0; @@ -135,6 +133,10 @@ namespace Porygon::Evaluation { return this->EvaluateBool() == b->EvaluateBool(); }; + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline std::size_t GetHashCode() const final { return _value; diff --git a/src/Evaluator/EvalValues/NilEvalValue.hpp b/src/Evaluator/EvalValues/NilEvalValue.hpp index 14ace3e..233ab0f 100644 --- a/src/Evaluator/EvalValues/NilEvalValue.hpp +++ b/src/Evaluator/EvalValues/NilEvalValue.hpp @@ -14,6 +14,10 @@ namespace Porygon::Evaluation{ return b->GetTypeClass() == TypeClass ::Nil; } + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline EvalValue* Clone() const final{ return new NilEvalValue(); diff --git a/src/Evaluator/EvalValues/NumericEvalValue.hpp b/src/Evaluator/EvalValues/NumericEvalValue.hpp index 3cbf698..914abbf 100644 --- a/src/Evaluator/EvalValues/NumericEvalValue.hpp +++ b/src/Evaluator/EvalValues/NumericEvalValue.hpp @@ -30,6 +30,10 @@ namespace Porygon::Evaluation { bool operator==(const EvalValue *b) const final; + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] EvalValue *Clone() const override; [[nodiscard]] size_t GetHashCode() const override; [[nodiscard]] EvalValue* Cast(shared_ptr castType) const final; diff --git a/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp b/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp index f7f9b21..9a5c1db 100644 --- a/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp +++ b/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp @@ -38,6 +38,10 @@ namespace Porygon::Evaluation { return this->_hash == b->GetHashCode(); } + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline EvalValue* Clone() const final { return new NumericalTableEvalValue(_table, _hash); diff --git a/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp b/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp index 26aacbc..79f9ad9 100644 --- a/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp +++ b/src/Evaluator/EvalValues/ScriptFunctionEvalValue.hpp @@ -82,6 +82,10 @@ namespace Porygon::Evaluation { return this->_hash == ((GenericFunctionEvalValue *) b)->_hash; }; + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + inline std::size_t GetHashCode() const final { return _hash; } diff --git a/src/Evaluator/EvalValues/StringEvalValue.hpp b/src/Evaluator/EvalValues/StringEvalValue.hpp index 41d28ee..5c3ef85 100644 --- a/src/Evaluator/EvalValues/StringEvalValue.hpp +++ b/src/Evaluator/EvalValues/StringEvalValue.hpp @@ -32,6 +32,10 @@ namespace Porygon::Evaluation { return this->_hash == b->GetHashCode(); }; + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline u16string EvaluateString() const final { return *_value.get(); diff --git a/src/Evaluator/EvalValues/TableEvalValue.hpp b/src/Evaluator/EvalValues/TableEvalValue.hpp index 4ec62c8..a663099 100644 --- a/src/Evaluator/EvalValues/TableEvalValue.hpp +++ b/src/Evaluator/EvalValues/TableEvalValue.hpp @@ -42,6 +42,10 @@ namespace Porygon::Evaluation { return this->_hash == b->GetHashCode(); } + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline EvalValue* Clone() const final { return new TableEvalValue(_table, _hash); diff --git a/src/UserData/UserDataCollections/UserDataCollectionValue.hpp b/src/UserData/UserDataCollections/UserDataCollectionValue.hpp index 1d382aa..5ec7625 100644 --- a/src/UserData/UserDataCollections/UserDataCollectionValue.hpp +++ b/src/UserData/UserDataCollections/UserDataCollectionValue.hpp @@ -60,6 +60,10 @@ namespace Porygon::UserData { return b->GetHashCode() == _hash; } + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] EvalValue* Clone() const final{ return new UserDataCollectionValue(_type, _helper, _hash); } diff --git a/src/UserData/UserDataValue.hpp b/src/UserData/UserDataValue.hpp index 16219b7..acb276a 100644 --- a/src/UserData/UserDataValue.hpp +++ b/src/UserData/UserDataValue.hpp @@ -37,6 +37,10 @@ namespace Porygon::UserData { return _obj == ((UserDataValue *) b)->_obj; } + bool operator!=(const EvalValue *b) const override { + return !operator==(b); + } + [[nodiscard]] inline Evaluation::EvalValue* Clone() const final { auto ud = _userData->Get(); @@ -78,6 +82,7 @@ namespace Porygon::UserData { EvalValue* Cast(shared_ptr castType) const final{ return _userData->Get()->Cast(_obj, castType.get()); } + }; }