Exemplo n.º 1
0
MetadataResponse
irgen::emitArchetypeTypeMetadataRef(IRGenFunction &IGF,
                                    CanArchetypeType archetype,
                                    DynamicMetadataRequest request) {
  // Check for an existing cache entry.
  if (auto response = IGF.tryGetLocalTypeMetadata(archetype, request))
    return response;

  // If that's not present, this must be an associated type.
  assert(!archetype->isPrimary() &&
         "type metadata for primary archetype was not bound in context");

  CanArchetypeType parent(archetype->getParent());
  AssociatedType association(archetype->getAssocType());

  MetadataResponse response =
    emitAssociatedTypeMetadataRef(IGF, parent, association, request);

  setTypeMetadataName(IGF.IGM, response.getMetadata(), archetype);

  IGF.setScopedLocalTypeMetadata(archetype, response);

  return response;
}