@@ -166,11 +166,11 @@ void TypeVisitor::visitLValueType(swift::LValueType* type) {
166166 dispatcher_.emit (LValueTypesTrap{label, dispatcher_.fetchLabel (type->getObjectType ())});
167167}
168168
169- void TypeVisitor::visitPrimaryArchetypeType (swift::PrimaryArchetypeType* type) {
170- auto label = dispatcher_. assignNewLabel ( type);
171- assert (type-> getInterfaceType () && " expect PrimaryArchetypeType to have InterfaceType " ) ;
172- dispatcher_. emit (
173- PrimaryArchetypeTypesTrap{label, dispatcher_. fetchLabel (type-> getInterfaceType ())}) ;
169+ codeql::PrimaryArchetypeType TypeVisitor::translatePrimaryArchetypeType (
170+ const swift::PrimaryArchetypeType& type) {
171+ PrimaryArchetypeType entry{dispatcher_. assignNewLabel (type)} ;
172+ fillArchetypeType (type, entry);
173+ return entry ;
174174}
175175
176176void TypeVisitor::visitUnboundGenericType (swift::UnboundGenericType* type) {
@@ -232,4 +232,26 @@ void TypeVisitor::emitAnyGenericType(swift::AnyGenericType* type,
232232 }
233233}
234234
235+ codeql::NestedArchetypeType TypeVisitor::translateNestedArchetypeType (
236+ const swift::NestedArchetypeType& type) {
237+ codeql::NestedArchetypeType entry{dispatcher_.assignNewLabel (type)};
238+ entry.parent = dispatcher_.fetchLabel (type.getParent ());
239+ entry.associated_type_declaration = dispatcher_.fetchLabel (type.getAssocType ());
240+ fillArchetypeType (type, entry);
241+ return entry;
242+ }
243+
244+ void TypeVisitor::fillType (const swift::TypeBase& type, codeql::Type& entry) {
245+ entry.diagnostics_name = type.getString ();
246+ entry.canonical_type = dispatcher_.fetchLabel (type.getCanonicalType ());
247+ }
248+
249+ void TypeVisitor::fillArchetypeType (const swift::ArchetypeType& type, ArchetypeType& entry) {
250+ entry.interface_type = dispatcher_.fetchLabel (type.getInterfaceType ());
251+ entry.name = type.getName ().str ().str ();
252+ entry.protocols = dispatcher_.fetchRepeatedLabels (type.getConformsTo ());
253+ entry.superclass = dispatcher_.fetchOptionalLabel (type.getSuperclass ());
254+ fillType (type, entry);
255+ }
256+
235257} // namespace codeql
0 commit comments