MCPcopy Create free account
hub / github.com/KDE/kdevelop / setSubScope

Method setSubScope

plugins/clang/codegen/sourcemanipulation.cpp:101–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void SourceCodeInsertion::setSubScope(const QualifiedIdentifier& scope)
102{
103 m_scope = scope;
104
105 if (!m_context) {
106 return;
107 }
108
109 QStringList needNamespace = m_scope.toStringList();
110
111 bool foundChild = true;
112 while (!needNamespace.isEmpty() && foundChild) {
113 foundChild = false;
114
115 const auto childContexts = m_context->childContexts();
116 for (DUContext* child : childContexts) {
117 clangDebug() << "checking child" << child->localScopeIdentifier().toString() << "against"
118 << needNamespace.first();
119 if (child->localScopeIdentifier().toString() == needNamespace.first() && child->type() == DUContext::Namespace) {
120 clangDebug() << "taking";
121 m_context = child;
122 foundChild = true;
123 needNamespace.pop_front();
124 break;
125 }
126 }
127 }
128
129 m_scope = stripPrefixes(m_context, QualifiedIdentifier(needNamespace.join(QLatin1String("::"))));
130}
131
132QString SourceCodeInsertion::applySubScope(const QString& decl) const
133{

Callers 1

moveIntoSourceMethod · 0.80

Calls 10

stripPrefixesFunction · 0.85
childContextsMethod · 0.80
localScopeIdentifierMethod · 0.80
joinMethod · 0.80
QualifiedIdentifierClass · 0.50
toStringListMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45
firstMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected