Added FindClass

Allows for classes to be looked up during run time without having to use string casting.
This commit is contained in:
Boondorl 2025-02-20 01:58:34 -05:00 committed by Rachael Alexanderson
commit 5a5bed5c31
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
2 changed files with 2 additions and 1 deletions

View file

@ -12367,7 +12367,7 @@ static PClass *NativeNameToClass(int _clsname, PClass *desttype)
if (clsname != NAME_None)
{
cls = PClass::FindClass(clsname);
if (cls != nullptr && (cls->VMType == nullptr || !cls->IsDescendantOf(desttype)))
if (cls != nullptr && (cls->VMType == nullptr || (desttype != nullptr && !cls->IsDescendantOf(desttype))))
{
// does not match required parameters or is invalid.
return nullptr;

View file

@ -767,6 +767,7 @@ class Object native
private native static bool CheckDeprecatedFlags(Object obj, int index);
native static Name ValidateNameIndex(int index);
static class<Object> FindClass(Name cls, class<Object> baseType = null) { return BuiltinNameToClass(cls, baseType); }
native static uint MSTime();
native static double MSTimeF();