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 Ricardo Luís Vaz Silva
parent 9f6c1d65c5
commit 236c9b4224
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

@ -771,6 +771,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();