This commit is contained in:
@@ -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(){
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user