| 27 | //////////////////////////////////////////////////////////////////////////////// |
| 28 | |
| 29 | void UniqueIdChecker::makeIdsUnique(InterfaceDefinition &def) |
| 30 | { |
| 31 | initUsedInterfaceIds(def.getGlobals().getSymbolsOfType(Symbol::symbol_type_t::kInterfaceSymbol)); |
| 32 | |
| 33 | for (auto it : def.getGlobals().getSymbolsOfType(Symbol::symbol_type_t::kInterfaceSymbol)) |
| 34 | { |
| 35 | assert(nullptr != it); |
| 36 | Interface *interface = dynamic_cast<Interface *>(it); |
| 37 | assert(interface); |
| 38 | if (Annotation *interfaceId = interface->findAnnotation(ID_ANNOTATION, Annotation::program_lang_t::kAll)) |
| 39 | { |
| 40 | setInterfaceId(interface, interfaceId); |
| 41 | } |
| 42 | initUsedFunctionIds(interface); |
| 43 | for (auto function : interface->getFunctions()) |
| 44 | { |
| 45 | if (Annotation *functionId = function->findAnnotation(ID_ANNOTATION, Annotation::program_lang_t::kAll)) |
| 46 | { |
| 47 | setFunctionId(function, functionId); |
| 48 | } |
| 49 | } |
| 50 | if (0 < m_usedFunctionIds.size()) |
| 51 | { |
| 52 | checkDuplicateIds(m_usedFunctionIds, "function"); |
| 53 | } |
| 54 | } |
| 55 | if (0 < m_usedInterfaceIds.size()) |
| 56 | { |
| 57 | checkDuplicateIds(m_usedInterfaceIds, "interface"); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | void UniqueIdChecker::initUsedInterfaceIds(SymbolScope::symbol_vector_t ifaces) |
| 62 | { |
no test coverage detected