Add ScriptingTypeHandle::IsAssignableFrom

This commit is contained in:
Wojtek Figat
2021-09-23 13:46:47 +02:00
parent ef78d9e9ed
commit 8d512eb1d3
2 changed files with 12 additions and 0 deletions

View File

@@ -49,6 +49,17 @@ const ScriptingType& ScriptingTypeHandle::GetType() const
return Module->Types[TypeIndex];
}
bool ScriptingTypeHandle::IsAssignableFrom(ScriptingTypeHandle c) const
{
while (c)
{
if (c == *this)
return true;
c = c.GetType().GetBaseType();
}
return false;
}
bool ScriptingTypeHandle::operator==(const ScriptingTypeInitializer& other) const
{
return Module == other.Module && TypeIndex == other.TypeIndex;