mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Introduce BuiltinProtocolConformance
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -562,6 +562,34 @@ ModuleFile::readConformanceChecked(llvm::BitstreamCursor &Cursor,
|
||||
return ProtocolConformanceRef(conformance);
|
||||
}
|
||||
|
||||
case BUILTIN_PROTOCOL_CONFORMANCE: {
|
||||
TypeID conformingTypeID;
|
||||
DeclID protoID;
|
||||
size_t numConformances;
|
||||
BuiltinProtocolConformanceLayout::readRecord(scratch, conformingTypeID,
|
||||
protoID, numConformances);
|
||||
|
||||
Type conformingType = getType(conformingTypeID);
|
||||
|
||||
auto decl = getDeclChecked(protoID);
|
||||
if (!decl)
|
||||
return decl.takeError();
|
||||
|
||||
auto proto = cast<ProtocolDecl>(decl.get());
|
||||
|
||||
// Read the conformances.
|
||||
SmallVector<ProtocolConformanceRef, 4> conformances;
|
||||
conformances.reserve(numConformances);
|
||||
for (unsigned i : range(numConformances)) {
|
||||
(void)i;
|
||||
conformances.push_back(readConformance(Cursor));
|
||||
}
|
||||
|
||||
auto conformance = getContext().getBuiltinConformance(conformingType, proto,
|
||||
conformances);
|
||||
return ProtocolConformanceRef(conformance);
|
||||
}
|
||||
|
||||
case NORMAL_PROTOCOL_CONFORMANCE_ID: {
|
||||
NormalConformanceID conformanceID;
|
||||
NormalProtocolConformanceIdLayout::readRecord(scratch, conformanceID);
|
||||
|
||||
Reference in New Issue
Block a user