registerType method

void registerType(
  1. TypeIdentifier typeIdentifier,
  2. Set<TypeIdentifier> baseTypeIdentifiers
)

registers the given typeIdentifier with the given baseTypeIdentifiers

Implementation

void registerType(
  TypeIdentifier typeIdentifier,
  Set<TypeIdentifier> baseTypeIdentifiers,
) {
  if (!_types.containsKey(typeIdentifier.packageAndTypeName)) {
    _types[typeIdentifier.packageAndTypeName] = {};
  }
  // the set type the new item gets added to makes sure that we don't add the same type twice
  // only if there are multiple occasions of types with the same name then we end up with multiple entries here (which is intended)
  _types[typeIdentifier.packageAndTypeName]!.add(
    _TypeHierarchyItem(
      typeIdentifier: typeIdentifier,
      baseTypeIdentifiers: baseTypeIdentifiers,
    ),
  );
}