[serialization] Add support for oneofs.

Since SILGen support is so poor, the test just uses -parse.

Swift SVN r6136
This commit is contained in:
Jordan Rose
2013-07-10 23:26:00 +00:00
parent 1564fa7f10
commit ca6f08164f
5 changed files with 178 additions and 3 deletions

View File

@@ -237,6 +237,8 @@ namespace decls_block {
POSTFIX_OPERATOR_DECL,
INFIX_OPERATOR_DECL,
CLASS_DECL,
ONEOF_DECL,
ONEOF_ELEMENT_DECL,
PAREN_PATTERN = 200,
TUPLE_PATTERN,
@@ -406,6 +408,7 @@ namespace decls_block {
using StructLayout = NominalLayout<STRUCT_DECL>;
using ProtocolLayout = NominalLayout<PROTOCOL_DECL>;
using ClassLayout = NominalLayout<CLASS_DECL>;
using OneOfLayout = NominalLayout<ONEOF_DECL>;
using ConstructorLayout = BCRecordLayout<
CONSTRUCTOR_DECL,
@@ -466,6 +469,15 @@ namespace decls_block {
BCFixed<8> // precedence
>;
using OneOfElementLayout = BCRecordLayout<
ONEOF_ELEMENT_DECL,
IdentifierIDField, // name
DeclIDField, // context decl
TypeIDField, // argument type
TypeIDField, // constructor type
BCFixed<1> // implicit?
>;
using ParenPatternLayout = BCRecordLayout<
PAREN_PATTERN