Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/usebuilder.cpp
Context not available. | |||||
244 | UseBuilderBase::visitUseStatement(node); | 244 | UseBuilderBase::visitUseStatement(node); | ||
---|---|---|---|---|---|
245 | } | 245 | } | ||
246 | 246 | | |||
247 | void UseBuilder::visitUseNamespace(UseNamespaceAst* node) | 247 | void UseBuilder::visitUseNamespaceOrUseGroupedNamespace(UseNamespaceOrUseGroupedNamespaceAst* node) | ||
248 | { | 248 | { | ||
249 | buildNamespaceUses(node->identifier, m_useNamespaceType); | 249 | if (!node->compoundNamespace) { | ||
250 | buildNamespaceUses(node->identifier, m_useNamespaceType); | ||||
251 | } | ||||
252 | } | ||||
253 | | ||||
254 | void UseBuilder::buildNamespaceUses(NamespacedIdentifierBeforeGroupedNamespaceAst* node, DeclarationType lastType) | ||||
255 | { | ||||
256 | QualifiedIdentifier identifier = identifierForNamespace(node, m_editor, lastType == ConstantDeclarationType); | ||||
257 | buildNamespaceUses(identifier, node->namespaceNameSequence, lastType); | ||||
250 | } | 258 | } | ||
251 | 259 | | |||
252 | void UseBuilder::buildNamespaceUses(NamespacedIdentifierAst* node, DeclarationType lastType) | 260 | void UseBuilder::buildNamespaceUses(NamespacedIdentifierAst* node, DeclarationType lastType) | ||
253 | { | 261 | { | ||
254 | QualifiedIdentifier identifier = identifierForNamespace(node, m_editor, lastType == ConstantDeclarationType); | 262 | QualifiedIdentifier identifier = identifierForNamespace(node, m_editor, lastType == ConstantDeclarationType); | ||
263 | buildNamespaceUses(identifier, node->namespaceNameSequence, lastType); | ||||
264 | } | ||||
255 | 265 | | |||
266 | void UseBuilder::buildNamespaceUses( | ||||
267 | KDevelop::QualifiedIdentifier identifier, | ||||
268 | const KDevPG::ListNode<IdentifierAst *>* namespaceNameSequence, | ||||
269 | Php::DeclarationType lastType) | ||||
270 | { | ||||
256 | QualifiedIdentifier curId; | 271 | QualifiedIdentifier curId; | ||
257 | 272 | | |||
258 | // check if we need to resolve the namespaced identifier globally or locally | 273 | // check if we need to resolve the namespaced identifier globally or locally | ||
Context not available. | |||||
278 | } | 293 | } | ||
279 | 294 | | |||
280 | curId.setExplicitlyGlobal(identifier.explicitlyGlobal()); | 295 | curId.setExplicitlyGlobal(identifier.explicitlyGlobal()); | ||
281 | Q_ASSERT(identifier.count() == node->namespaceNameSequence->count()); | 296 | Q_ASSERT(identifier.count() == namespaceNameSequence->count()); | ||
282 | for ( int i = 0; i < identifier.count() - 1; ++i ) { | 297 | for ( int i = 0; i < identifier.count() - 1; ++i ) { | ||
283 | curId.push(identifier.at(i)); | 298 | curId.push(identifier.at(i)); | ||
284 | AstNode* n = node->namespaceNameSequence->at(i)->element; | 299 | AstNode* n = namespaceNameSequence->at(i)->element; | ||
285 | DeclarationPointer dec = findDeclarationImport(NamespaceDeclarationType, curId); | 300 | DeclarationPointer dec = findDeclarationImport(NamespaceDeclarationType, curId); | ||
286 | if (!dec || dec->range() != editorFindRange(n, n)) { | 301 | if (!dec || dec->range() != editorFindRange(n, n)) { | ||
287 | newCheckedUse(n, dec, true); | 302 | newCheckedUse(n, dec, true); | ||
288 | } | 303 | } | ||
289 | } | 304 | } | ||
290 | newCheckedUse(node->namespaceNameSequence->back()->element, | 305 | newCheckedUse(namespaceNameSequence->back()->element, | ||
291 | findDeclarationImport(lastType, identifier), | 306 | findDeclarationImport(lastType, identifier), | ||
292 | lastType == ClassDeclarationType || lastType == ConstantDeclarationType | 307 | lastType == ClassDeclarationType || lastType == ConstantDeclarationType | ||
293 | || lastType == FunctionDeclarationType || lastType == NamespaceDeclarationType); | 308 | || lastType == FunctionDeclarationType || lastType == NamespaceDeclarationType); | ||
Context not available. |