diff options
Diffstat (limited to 'idlc/source/astinterface.cxx')
-rw-r--r-- | idlc/source/astinterface.cxx | 137 |
1 files changed, 70 insertions, 67 deletions
diff --git a/idlc/source/astinterface.cxx b/idlc/source/astinterface.cxx index 991759384869..a5f2ed21bf2c 100644 --- a/idlc/source/astinterface.cxx +++ b/idlc/source/astinterface.cxx @@ -253,54 +253,55 @@ void AstInterface::checkInheritedInterfaceClashes( std::set< OString > & seenInterfaces, AstInterface const * ifc, bool direct, bool optional, bool mainOptional) const { - if (direct || optional - || seenInterfaces.insert(ifc->getScopedName()).second) - { - VisibleInterfaces::const_iterator visible( - m_visibleInterfaces.find(ifc->getScopedName())); - if (visible != m_visibleInterfaces.end()) { - switch (visible->second) { - case INTERFACE_INDIRECT_OPTIONAL: - if (direct && optional) { - doubleDeclarations.interfaces.push_back(ifc); - return; - } - break; - - case INTERFACE_DIRECT_OPTIONAL: - if (direct || !mainOptional) { - doubleDeclarations.interfaces.push_back(ifc); - } - return; - - case INTERFACE_INDIRECT_MANDATORY: - if (direct) { - doubleDeclarations.interfaces.push_back(ifc); - } + if (!(direct || optional + || seenInterfaces.insert(ifc->getScopedName()).second)) + return; + + VisibleInterfaces::const_iterator visible( + m_visibleInterfaces.find(ifc->getScopedName())); + if (visible != m_visibleInterfaces.end()) { + switch (visible->second) { + case INTERFACE_INDIRECT_OPTIONAL: + if (direct && optional) { + doubleDeclarations.interfaces.push_back(ifc); return; + } + break; - case INTERFACE_DIRECT_MANDATORY: - if (direct || (!optional && !mainOptional)) { - doubleDeclarations.interfaces.push_back(ifc); - } - return; + case INTERFACE_DIRECT_OPTIONAL: + if (direct || !mainOptional) { + doubleDeclarations.interfaces.push_back(ifc); } - } - if (direct || !optional) { - for (DeclList::const_iterator i(ifc->getIteratorBegin()); - i != ifc->getIteratorEnd(); ++i) - { - checkMemberClashes( - doubleDeclarations.members, *i, !mainOptional); + return; + + case INTERFACE_INDIRECT_MANDATORY: + if (direct) { + doubleDeclarations.interfaces.push_back(ifc); } - for (auto const& elem : ifc->m_inheritedInterfaces) - { - checkInheritedInterfaceClashes( - doubleDeclarations, seenInterfaces, elem.getResolved(), - false, elem.isOptional(), mainOptional); + return; + + case INTERFACE_DIRECT_MANDATORY: + if (direct || (!optional && !mainOptional)) { + doubleDeclarations.interfaces.push_back(ifc); } + return; } } + if (!(direct || !optional)) + return; + + for (DeclList::const_iterator i(ifc->getIteratorBegin()); + i != ifc->getIteratorEnd(); ++i) + { + checkMemberClashes( + doubleDeclarations.members, *i, !mainOptional); + } + for (auto const& elem : ifc->m_inheritedInterfaces) + { + checkInheritedInterfaceClashes( + doubleDeclarations, seenInterfaces, elem.getResolved(), + false, elem.isOptional(), mainOptional); + } } void AstInterface::checkMemberClashes( @@ -309,25 +310,26 @@ void AstInterface::checkMemberClashes( { VisibleMembers::const_iterator i( m_visibleMembers.find(member->getLocalName())); - if (i != m_visibleMembers.end()) { - if (i->second.mandatory != nullptr) { - if (i->second.mandatory->getScopedName() != member->getScopedName()) - { + if (i == m_visibleMembers.end()) + return; + + if (i->second.mandatory != nullptr) { + if (i->second.mandatory->getScopedName() != member->getScopedName()) + { + DoubleMemberDeclaration d; + d.first = i->second.mandatory; + d.second = member; + doubleMembers.push_back(d); + } + } else if (checkOptional) { + for (auto const& elem : i->second.optionals) + { + if (elem.second->getScopedName() != member->getScopedName()) { DoubleMemberDeclaration d; - d.first = i->second.mandatory; + d.first = elem.second; d.second = member; doubleMembers.push_back(d); } - } else if (checkOptional) { - for (auto const& elem : i->second.optionals) - { - if (elem.second->getScopedName() != member->getScopedName()) { - DoubleMemberDeclaration d; - d.first = elem.second; - d.second = member; - doubleMembers.push_back(d); - } - } } } } @@ -345,17 +347,18 @@ void AstInterface::addVisibleInterface( if (!result.second && kind > result.first->second) { result.first->second = kind; } - if (!optional && !seen) { - for (DeclList::const_iterator i(ifc->getIteratorBegin()); - i != ifc->getIteratorEnd(); ++i) - { - m_visibleMembers.emplace( - (*i)->getLocalName(), VisibleMember(*i)); - } - for (auto const& elem : ifc->m_inheritedInterfaces) - { - addVisibleInterface(elem.getResolved(), false, elem.isOptional()); - } + if (optional || seen) + return; + + for (DeclList::const_iterator i(ifc->getIteratorBegin()); + i != ifc->getIteratorEnd(); ++i) + { + m_visibleMembers.emplace( + (*i)->getLocalName(), VisibleMember(*i)); + } + for (auto const& elem : ifc->m_inheritedInterfaces) + { + addVisibleInterface(elem.getResolved(), false, elem.isOptional()); } } |