mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Add support for generic functions.
This currently does a little dance to handle PolymorphicFunctionTypes. These are currently implemented by referencing the GenericParamList of an actual polymorphic function, so they can't be deserialized without knowing which function they are attached to. To solve this, PolymorphicFunctionTypes are serialized as regular FunctionTypes. Then, when a generic function decl is being deserialized, it will rebuild a PolymorphicFunctionType from the serialized type and its own generic parameter list. Requirements on the generic types are coming next. Swift SVN r5983
This commit is contained in:
@@ -211,6 +211,10 @@ namespace decls_block {
|
||||
NOMINAL_TYPE_PATTERN,
|
||||
VAR_PATTERN,
|
||||
|
||||
GENERIC_PARAM_LIST = 240,
|
||||
GENERIC_PARAM,
|
||||
GENERIC_REQUIREMENT,
|
||||
|
||||
XREF = 254,
|
||||
DECL_CONTEXT = 255
|
||||
};
|
||||
@@ -338,6 +342,8 @@ namespace decls_block {
|
||||
BCFixed<1>, // class method
|
||||
DeclIDField, // associated decl (for get/set or operators)
|
||||
DeclIDField // overridden function
|
||||
// The record is trailed by its generic parameters, if any, followed by its
|
||||
// argument and body parameter patterns.
|
||||
>;
|
||||
|
||||
using PatternBindingLayout = BCRecordLayout<
|
||||
@@ -407,6 +413,18 @@ namespace decls_block {
|
||||
// The sub-pattern trails the record.
|
||||
>;
|
||||
|
||||
|
||||
using GenericParamListLayout = BCRecordLayout<
|
||||
GENERIC_PARAM_LIST,
|
||||
BCArray<TypeIDField> // Archetypes
|
||||
// The actual parameters and requirements trail the record.
|
||||
>;
|
||||
|
||||
using GenericParamLayout = BCRecordLayout<
|
||||
GENERIC_PARAM,
|
||||
DeclIDField // Typealias
|
||||
>;
|
||||
|
||||
using XRefLayout = BCRecordLayout<
|
||||
XREF,
|
||||
XRefKindField, // reference kind
|
||||
|
||||
Reference in New Issue
Block a user