Make numerical table type countable
This commit is contained in:
parent
98b605a18b
commit
e89782f921
|
@ -60,7 +60,11 @@ namespace Porygon::Evaluation {
|
||||||
|
|
||||||
inline void SetIndexValue(const EvalValue *key, const EvalValue* value) const final {
|
inline void SetIndexValue(const EvalValue *key, const EvalValue* value) const final {
|
||||||
auto index = key->EvaluateInteger();
|
auto index = key->EvaluateInteger();
|
||||||
this->_table->at(index - 1) = value;
|
index--;
|
||||||
|
if (this->_table->size() <= index){
|
||||||
|
this->_table->resize(index);
|
||||||
|
}
|
||||||
|
this->_table->at(index) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
@ -71,7 +75,7 @@ namespace Porygon::Evaluation {
|
||||||
return _table;
|
return _table;
|
||||||
}
|
}
|
||||||
|
|
||||||
EvalValue *UnaryOperation(Binder::BoundUnaryOperation operation) const override;;
|
[[nodiscard]] EvalValue *UnaryOperation(Binder::BoundUnaryOperation operation) const override;;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,10 @@ namespace Porygon{
|
||||||
inline shared_ptr<const ScriptType> GetIteratorKeyType() const final{
|
inline shared_ptr<const ScriptType> GetIteratorKeyType() const final{
|
||||||
return NumericScriptType::AwareInt;
|
return NumericScriptType::AwareInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool IsCountable() const override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue