14 lines
501 B
C++
14 lines
501 B
C++
#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();
|
|
}
|
|
|
|
shared_ptr<ScriptType> ScriptType::GetIndexedType(ScriptType *indexer) {
|
|
if (_class == TypeClass::String){
|
|
return make_shared<ScriptType>(TypeClass::String);
|
|
}
|
|
return make_shared<ScriptType>(TypeClass::Error);
|
|
}
|