Require explicit inequality as well as equality operators on evalvalues
This commit is contained in:
parent
d8c67f2dde
commit
fab2c9eabd
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<const ScriptType> castType) const final;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<const ScriptType> castType) const final{
|
||||
return _userData->Get()->Cast(_obj, castType.get());
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue