2019-06-06 15:35:51 +00:00
|
|
|
#include "Script.hpp"
|
|
|
|
|
|
|
|
bool ScriptType::CanBeIndexedWith(ScriptType *indexer) {
|
|
|
|
// String type is the only simple script type we want to
|
|
|
|
return _class == TypeClass::String && indexer->_class == TypeClass::Number && !((NumericScriptType*)indexer)->IsFloat();
|
|
|
|
}
|
|
|
|
|
2019-06-09 18:15:09 +00:00
|
|
|
shared_ptr<ScriptType> ScriptType::GetIndexedType(ScriptType *indexer) {
|
2019-06-06 15:35:51 +00:00
|
|
|
if (_class == TypeClass::String){
|
2019-06-09 18:15:09 +00:00
|
|
|
return make_shared<ScriptType>(TypeClass::String);
|
2019-06-06 15:35:51 +00:00
|
|
|
}
|
2019-06-09 18:15:09 +00:00
|
|
|
return make_shared<ScriptType>(TypeClass::Error);
|
2019-06-06 15:35:51 +00:00
|
|
|
}
|