Many fixes for script handling.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-22 14:11:03 +01:00
parent c56b001ce4
commit f8427fa594
8 changed files with 43 additions and 16 deletions

View File

@@ -312,7 +312,7 @@ void AngelScriptResolver::InitializeByteCode(
ArbUt::Dictionary<uint32_t, asITypeInfo*> objectTypes;
for (asUINT i = 0; i < typeCount; i++) {
auto t = _mainModule->GetObjectTypeByIndex(i);
objectTypes.Insert(ArbUt::StringView::CalculateHash(t->GetName()), t);
objectTypes.Set(ArbUt::StringView::CalculateHash(t->GetName()), t);
}
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> typeDatabase;
for (const auto& innerDb : types) {
@@ -320,9 +320,9 @@ void AngelScriptResolver::InitializeByteCode(
for (const auto& val : innerDb.second) {
auto decl = val.second;
auto type = objectTypes[decl];
newInnerDb.Insert(val.first, new AngelScriptTypeInfo(val.first, type));
newInnerDb.Set(val.first, new AngelScriptTypeInfo(val.first, type));
}
typeDatabase.Insert(innerDb.first, newInnerDb);
typeDatabase.Set(innerDb.first, newInnerDb);
}
_typeDatabase = typeDatabase;
}

View File

@@ -26,6 +26,7 @@ public:
~AngelScriptScript() override { _obj->Release(); }
[[nodiscard]] const ArbUt::StringView& GetName() const noexcept override { return _type->GetName(); }
const AngelScriptTypeInfo* GetType() const noexcept { return _type; }
asIScriptFunction* PrepareMethod(const ArbUt::BasicStringView& name, asIScriptContext* ctx) {
auto func = _type->GetFunction(name);

View File

@@ -21,9 +21,6 @@ private:
if (val == nullptr) {
return FunctionInfo{.Exists = false, .Function = nullptr};
}
if (!val->IsOverride()) {
return FunctionInfo{.Exists = false, .Function = nullptr};
}
return FunctionInfo{.Exists = true, .Function = val};
}

View File

@@ -68,7 +68,8 @@ public:
if (isDecl) {
// Insert the name and decl into the dictionary. Close off the decl with eof as well.
decl[pos] = '\0';
innerDb.Insert(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
innerDb.Set(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
}
// If we have found \1, we are done with the current category, so break.
break;
@@ -79,7 +80,7 @@ public:
if (isDecl) {
// Insert the name and decl into the dictionary. Close off the decl with eof as well.
decl[pos] = '\0';
innerDb.Insert(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
innerDb.Set(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
// Reset our position and toggle back to name.
pos = 0;
isDecl = false;
@@ -101,7 +102,7 @@ public:
}
}
}
types.Insert(categoryArr[0], innerDb);
types.Set(categoryArr[0], innerDb);
}
return types;
}