@@ -124,7 +124,14 @@ unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitProt
124
124
125
125
unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitId (const ::Meta::IdType& type)
126
126
{
127
- return llvm::make_unique<binary::TypeEncoding>(binary::BinaryTypeEncodingType::Id); // TODO: Add protocols
127
+ auto s = llvm::make_unique<binary::IdEncoding>();
128
+ std::vector<MetaFileOffset> offsets;
129
+ for (auto protocol : type.protocols ) {
130
+ offsets.push_back (this ->_heapWriter .push_string (protocol->jsName ));
131
+ }
132
+ s->_protocols = this ->_heapWriter .push_binaryArray (offsets);
133
+
134
+ return unique_ptr<binary::TypeEncoding>(s.release ());
128
135
}
129
136
130
137
unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitConstantArray (const ::Meta::ConstantArrayType& type)
@@ -144,8 +151,15 @@ unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitInco
144
151
145
152
unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitInterface (const ::Meta::InterfaceType& type)
146
153
{
147
- binary::DeclarationReferenceEncoding * s = new binary::DeclarationReferenceEncoding (BinaryTypeEncodingType::InterfaceDeclarationReference );
154
+ auto * s = new binary::InterfaceDeclarationReferenceEncoding ( );
148
155
s->_name = this ->_heapWriter .push_string (type.interface ->jsName );
156
+
157
+ std::vector<MetaFileOffset> offsets;
158
+ for (auto protocol : type.protocols ) {
159
+ offsets.push_back (this ->_heapWriter .push_string (protocol->jsName ));
160
+ }
161
+ s->_protocols = this ->_heapWriter .push_binaryArray (offsets);
162
+
149
163
return unique_ptr<binary::TypeEncoding>(s);
150
164
}
151
165
@@ -157,8 +171,12 @@ unique_ptr<binary::TypeEncoding> binary::BinaryTypeEncodingSerializer::visitBrid
157
171
if (type.bridgedInterface == nullptr ) {
158
172
throw logic_error (std::string (" Unresolved bridged interface for BridgedInterfaceType with name '" ) + type.bridgedInterface ->name + " '." );
159
173
}
160
- binary::DeclarationReferenceEncoding* s = new binary::DeclarationReferenceEncoding (BinaryTypeEncodingType::InterfaceDeclarationReference );
174
+ auto s = new binary::InterfaceDeclarationReferenceEncoding ( );
161
175
s->_name = this ->_heapWriter .push_string (type.bridgedInterface ->jsName );
176
+
177
+ std::vector<MetaFileOffset> offsets;
178
+ s->_protocols = this ->_heapWriter .push_binaryArray (offsets);
179
+
162
180
return unique_ptr<binary::TypeEncoding>(s);
163
181
}
164
182
0 commit comments