[Impl] 增加 prettyType,返回TypeInfo的FString, StructInstance自动输出父类TypeInfo
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Fig
|
||||
return id == other.id;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TypeInfoHash
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace Fig
|
||||
using ObjectPtr = std::shared_ptr<Object>;
|
||||
using List = std::vector<ObjectPtr>;
|
||||
|
||||
FString prettyType(ObjectPtr obj);
|
||||
|
||||
struct ValueKey
|
||||
{
|
||||
ObjectPtr value;
|
||||
|
||||
Reference in New Issue
Block a user