diff --git a/src/ScriptTypes/ScriptType.cpp b/src/ScriptTypes/ScriptType.cpp index f83819c..b9ce364 100644 --- a/src/ScriptTypes/ScriptType.cpp +++ b/src/ScriptTypes/ScriptType.cpp @@ -13,6 +13,7 @@ namespace Porygon{ shared_ptr NumericScriptType::AwareInt = make_shared(true, false); shared_ptr NumericScriptType::AwareFloat = make_shared(true, true); shared_ptr NumericScriptType::Unaware = make_shared(false, false); + shared_ptr StringScriptType::Dynamic = make_shared(false, Utilities::HashedString::CreateLookup(0)); @@ -84,6 +85,21 @@ namespace Porygon{ return ToString(this->_class); } + string NumericScriptType::ToString() const { + std::stringstream ss; + ss << "numeric "; + if (this->_awareOfFloat && _isFloat){ + ss << "(Known float)"; + } + else if (this ->_awareOfFloat && !_isFloat){ + ss << "(Known integer)"; + } + else{ + ss << "(Unknown)"; + } + return ss.str(); + } + bool ScriptType::IsCountable() const { return false; } diff --git a/src/ScriptTypes/ScriptType.hpp b/src/ScriptTypes/ScriptType.hpp index f626ad7..62844a7 100644 --- a/src/ScriptTypes/ScriptType.hpp +++ b/src/ScriptTypes/ScriptType.hpp @@ -125,6 +125,8 @@ namespace Porygon{ } return ScriptType::CastableTo(castType, explicitCast); } + + string ToString() const override; }; class StringScriptType : public ScriptType{