mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Add support for ArrayTypes.
...in a quest for completeness. ArrayTypes don't actually work yet (single-dimensional arrays are typed as slices), but when they do the test that is currently XFAIL'd should start passing. With this, all non-transient types can now be serialized and deserialized. Swift SVN r6101
This commit is contained in:
@@ -410,6 +410,7 @@ void Serializer::writeBlockInfoBlock() {
|
||||
RECORD(decls_block, BOUND_GENERIC_SUBSTITUTION);
|
||||
RECORD(decls_block, POLYMORPHIC_FUNCTION_TYPE);
|
||||
RECORD(decls_block, ARRAY_SLICE_TYPE);
|
||||
RECORD(decls_block, ARRAY_TYPE);
|
||||
RECORD(decls_block, REFERENCE_STORAGE_TYPE);
|
||||
|
||||
RECORD(decls_block, TYPE_ALIAS_DECL);
|
||||
@@ -1211,8 +1212,16 @@ bool Serializer::writeType(Type ty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
case TypeKind::Array:
|
||||
return false;
|
||||
case TypeKind::Array: {
|
||||
auto arrayTy = cast<ArrayType>(ty.getPointer());
|
||||
|
||||
Type base = arrayTy->getBaseType();
|
||||
|
||||
unsigned abbrCode = DeclTypeAbbrCodes[ArrayTypeLayout::Code];
|
||||
ArrayTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addTypeRef(base), arrayTy->getSize());
|
||||
return true;
|
||||
}
|
||||
|
||||
case TypeKind::ArraySlice: {
|
||||
auto sliceTy = cast<ArraySliceType>(ty.getPointer());
|
||||
@@ -1309,6 +1318,7 @@ void Serializer::writeAllDeclsAndTypes() {
|
||||
registerDeclTypeAbbr<BoundGenericSubstitutionLayout>();
|
||||
registerDeclTypeAbbr<PolymorphicFunctionTypeLayout>();
|
||||
registerDeclTypeAbbr<ArraySliceTypeLayout>();
|
||||
registerDeclTypeAbbr<ArrayTypeLayout>();
|
||||
|
||||
registerDeclTypeAbbr<TypeAliasLayout>();
|
||||
registerDeclTypeAbbr<StructLayout>();
|
||||
|
||||
Reference in New Issue
Block a user