[Impl] 增加 prettyType,返回TypeInfo的FString, StructInstance自动输出父类TypeInfo

This commit is contained in:
2025-12-29 20:34:04 +08:00
parent 31c2ae4d84
commit f19b14f45f
4 changed files with 25 additions and 15 deletions

View File

@@ -69,6 +69,14 @@ namespace Fig
}
}
FString prettyType(ObjectPtr obj)
{
auto t = obj->getTypeInfo();
if (t == ValueType::StructInstance)
return obj->as<StructInstance>().parentType.toString();
return t.toString();
}
const TypeInfo ValueType::Any(FString(u8"Any"), true); // id: 1
const TypeInfo ValueType::Null(FString(u8"Null"), true); // id: 2
const TypeInfo ValueType::Int(FString(u8"Int"), true); // id: 3