mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Move MetadataOrPack to Private.h
This commit is contained in:
@@ -122,12 +122,35 @@ std::string swift::nameForMetadata(const Metadata *type,
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string MetadataOrPack::nameForMetadata() const {
|
||||
if (isNull())
|
||||
return "<<nullptr>>";
|
||||
|
||||
if (isMetadata())
|
||||
return ::nameForMetadata(getMetadata());
|
||||
|
||||
std::string result = "Pack{";
|
||||
MetadataPackPointer pack = getMetadataPack();
|
||||
for (size_t i = 0, e = pack.getNumElements(); i < e; ++i) {
|
||||
if (i != 0)
|
||||
result += ", ";
|
||||
result += ::nameForMetadata(pack.getElements()[i]);
|
||||
}
|
||||
result += "}";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else // SWIFT_STDLIB_HAS_TYPE_PRINTING
|
||||
|
||||
std::string swift::nameForMetadata(const Metadata *type, bool qualified) {
|
||||
return "<<< type printer not available >>>";
|
||||
}
|
||||
|
||||
std::string MetadataOrPack::nameForMetadata() const {
|
||||
return "<<< type printer not available >>>";
|
||||
}
|
||||
|
||||
#endif // SWIFT_STDLIB_HAS_TYPE_PRINTING
|
||||
|
||||
/// Used as part of cache key for `TypeNameCache`.
|
||||
|
||||
Reference in New Issue
Block a user