Add information about whether we know a numeric script type is a float in GetBoundTreeString()

This commit is contained in:
Deukhoofd 2019-09-22 16:46:31 +02:00
parent 7bca80092d
commit eacdb8a593
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 18 additions and 0 deletions

View File

@ -13,6 +13,7 @@ namespace Porygon{
shared_ptr<const NumericScriptType> NumericScriptType::AwareInt = make_shared<const NumericScriptType>(true, false);
shared_ptr<const NumericScriptType> NumericScriptType::AwareFloat = make_shared<const NumericScriptType>(true, true);
shared_ptr<const NumericScriptType> NumericScriptType::Unaware = make_shared<const NumericScriptType>(false, false);
shared_ptr<const StringScriptType> StringScriptType::Dynamic = make_shared<const StringScriptType>(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;
}

View File

@ -125,6 +125,8 @@ namespace Porygon{
}
return ScriptType::CastableTo(castType, explicitCast);
}
string ToString() const override;
};
class StringScriptType : public ScriptType{