General cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-07-04 18:24:49 +02:00
parent 0446c1098b
commit bb0a6aba19
20 changed files with 90 additions and 92 deletions

View File

@@ -12,10 +12,8 @@ namespace Porygon::UserData{
Evaluation::EvalValue* (*_get)(void* obj);
void (*_set)(void* obj, Evaluation::EvalValue* val);
public:
UserDataField(ScriptType* type, Evaluation::EvalValue* (*getter)(void* obj), void (*setter)(void* obj, Evaluation::EvalValue* val)){
_type = shared_ptr<ScriptType>(type);
_get = getter;
_set = setter;
UserDataField(ScriptType* type, Evaluation::EvalValue* (*getter)(void* obj), void (*setter)(void* obj, Evaluation::EvalValue* val))
: _type(shared_ptr<ScriptType>(type)), _get(getter), _set(setter){
}
shared_ptr<ScriptType> GetType(){

View File

@@ -24,7 +24,7 @@ namespace Porygon::UserData {
if (indexer->GetClass() != TypeClass::String) {
return false;
}
auto str = (StringScriptType *) indexer;
auto str = dynamic_cast<StringScriptType*>(indexer);
if (!str->IsKnownAtBind())
return false;
return _userData->ContainsField(str->GetHashValue());
@@ -39,7 +39,7 @@ namespace Porygon::UserData {
}
const shared_ptr<ScriptType> GetIndexedType(ScriptType *indexer) const final {
auto stringKey = (StringScriptType *) indexer;
auto stringKey = dynamic_cast<StringScriptType*>(indexer);
if (stringKey->IsKnownAtBind()) {
return _userData->GetField(stringKey->GetHashValue())->GetType();
}