diff --git a/src/Evaluator/EvalValues/EvalValue.hpp b/src/Evaluator/EvalValues/EvalValue.hpp index f4f2ad3..249efe9 100644 --- a/src/Evaluator/EvalValues/EvalValue.hpp +++ b/src/Evaluator/EvalValues/EvalValue.hpp @@ -67,9 +67,9 @@ namespace Porygon::Evaluation { } [[nodiscard]] - virtual const EvalValue* IndexValue(uint32_t hash) const { + virtual const EvalValue* IndexValue(const Utilities::HashedString* hash) const { std::stringstream err; - err << "Can't index this EvalValue: " << ToString() << " with key hash: " << hash; + err << "Can't index this EvalValue: " << ToString() << " with key hash: " << hash->GetDebugString(); throw EvaluationException(err.str()); } diff --git a/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp b/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp index 1590ff3..f7f9b21 100644 --- a/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp +++ b/src/Evaluator/EvalValues/NumericalTableEvalValue.hpp @@ -50,8 +50,8 @@ namespace Porygon::Evaluation { } [[nodiscard]] - inline EvalValue* IndexValue(uint32_t hash) const final { - return this->_table->at(hash - 1)-> Clone(); + inline EvalValue* IndexValue(const Utilities::HashedString* hash) const final { + return this->_table->at(hash->GetHash() - 1)-> Clone(); } inline void SetIndexValue(const EvalValue *key, const EvalValue* value) const final { diff --git a/src/Evaluator/EvalValues/TableEvalValue.hpp b/src/Evaluator/EvalValues/TableEvalValue.hpp index 7eda4d1..4ec62c8 100644 --- a/src/Evaluator/EvalValues/TableEvalValue.hpp +++ b/src/Evaluator/EvalValues/TableEvalValue.hpp @@ -54,8 +54,8 @@ namespace Porygon::Evaluation { } [[nodiscard]] - inline EvalValue* IndexValue(uint32_t hash) const final { - return this->_table->at(Utilities::HashedString::CreateLookup(hash))->Clone(); + inline EvalValue* IndexValue(const Utilities::HashedString* hash) const final { + return this->_table->at(*hash)->Clone(); } [[nodiscard]] diff --git a/src/Evaluator/Evaluator.cpp b/src/Evaluator/Evaluator.cpp index 3e4f158..c5130ce 100644 --- a/src/Evaluator/Evaluator.cpp +++ b/src/Evaluator/Evaluator.cpp @@ -372,7 +372,7 @@ namespace Porygon::Evaluation { EvalValuePointer Evaluator::EvaluatePeriodIndexExpression(const BoundExpression *expression) { auto indexExpression = (BoundPeriodIndexExpression *) expression; - auto index = indexExpression->GetIndex()->GetHash(); + auto index = indexExpression->GetIndex(); auto indexable = this->EvaluateExpression(indexExpression->GetIndexableExpression()); return indexable->IndexValue(index); } diff --git a/src/UserData/UserDataValue.hpp b/src/UserData/UserDataValue.hpp index a8e874c..16219b7 100644 --- a/src/UserData/UserDataValue.hpp +++ b/src/UserData/UserDataValue.hpp @@ -58,8 +58,8 @@ namespace Porygon::UserData { } [[nodiscard]] - inline const EvalValue* IndexValue(uint32_t hash) const final { - auto field = _userData->Get()->GetField(hash); + inline const EvalValue* IndexValue(const Utilities::HashedString* hash) const final { + auto field = _userData->Get()->GetField(hash->GetHash()); return field->Get(_obj); }