[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevplatform/language/duchain
From: David Nolden <david.nolden.kde () art-master ! de>
Date: 2009-02-24 23:28:28
Message-ID: 1235518108.409796.25004.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 931205 by zwabel:
- Also apply namespace-imports within non-namespace contexts
- Do not filter out namespace-alias declarations if DUContext::NoFiltering is used
M +8 -7 ducontext.cpp
M +2 -1 ducontext.h
--- trunk/KDE/kdevplatform/language/duchain/ducontext.cpp #931204:931205
@@ -727,7 +727,7 @@
}
}
- if( declaration->kind() == Declaration::NamespaceAlias )
+ if( declaration->kind() == Declaration::NamespaceAlias && !(m_flags & \
NoFiltering) ) return 0;
if((m_flags & OnlyFunctions) && !declaration->isFunctionDeclaration())
@@ -823,10 +823,7 @@
///Step 1: Apply namespace-aliases and -imports
SearchItem::PtrList aliasedIdentifiers;
//Because of namespace-imports and aliases, this identifier may need to be \
searched under multiple names
- if( d_func()->m_contextType == Namespace )
- applyAliases(baseIdentifiers, aliasedIdentifiers, position, false);
- else
- aliasedIdentifiers = baseIdentifiers;
+ applyAliases(baseIdentifiers, aliasedIdentifiers, position, false, type() != \
DUContext::Namespace && type() != DUContext::Global);
if( d->m_importedContextsSize() != 0 ) {
@@ -1320,9 +1317,13 @@
return ret;
}
-void DUContext::applyAliases(const SearchItem::PtrList& baseIdentifiers, \
SearchItem::PtrList& identifiers, const SimpleCursor& position, bool canBeNamespace) \
const { +void DUContext::applyAliases(const SearchItem::PtrList& baseIdentifiers, \
SearchItem::PtrList& identifiers, const SimpleCursor& position, bool canBeNamespace, \
bool onlyImports) const {
QList<Declaration*> imports = allLocalDeclarations(globalImportIdentifier);
+ if(imports.isEmpty() && onlyImports) {
+ identifiers = baseIdentifiers;
+ return;
+ }
FOREACH_ARRAY( const SearchItem::Ptr& identifier, baseIdentifiers ) {
bool addUnmodified = true;
@@ -1410,7 +1411,7 @@
///Step 1: Apply namespace-aliases and -imports
SearchItem::PtrList aliasedIdentifiers;
//Because of namespace-imports and aliases, this identifier may need to be \
searched as under multiple names
- applyAliases(baseIdentifiers, aliasedIdentifiers, position, contextType == \
Namespace); + applyAliases(baseIdentifiers, aliasedIdentifiers, position, \
contextType == Namespace, contextType != Namespace);
if( d->m_importedContextsSize() != 0 ) {
///Step 2: Give identifiers that are not marked as explicitly-global to imported \
contexts(explicitly global ones are treatead in TopDUContext)
--- trunk/KDE/kdevplatform/language/duchain/ducontext.h #931204:931205
@@ -781,8 +781,9 @@
/**Applies namespace-imports and namespace-aliases and returns possible absolute \
identifiers that need to be searched.
* @param targetIdentifiers will be filled with all identifiers that should be \
searched for, instead of identifier. + * @param onlyImports if this is true, \
namespace-aliases will not be respected, but only imports. This is \
faster.
* */
- void applyAliases(const SearchItem::PtrList& identifiers, SearchItem::PtrList& \
targetIdentifiers, const SimpleCursor& position, bool canBeNamespace) const; + void \
applyAliases(const SearchItem::PtrList& identifiers, SearchItem::PtrList& \
targetIdentifiers, const SimpleCursor& position, bool canBeNamespace, bool \
onlyImports = false) const; /**
* Applies the aliases that need to be applied when moving the search from this \
context up to the parent-context.
* The default-implementation adds a set of identifiers with the own local \
identifier prefixed, if this is a namespace.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic