1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed recursion resolving namespaces (bug 234035).

This commit is contained in:
Sergey Prigogin 2008-05-26 21:26:33 +00:00
parent 79c2c87814
commit 109f2fb5fc

View file

@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
@ -334,8 +335,7 @@ public class CPPSemantics {
} }
} }
if (name.getParent() instanceof ICPPASTQualifiedName) { if (name.getParent() instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName)name.getParent()).getNames(); if (name == ((ICPPASTQualifiedName)name.getParent()).getLastName())
if (name == ns[ns.length - 1])
name = (IASTName) name.getParent(); name = (IASTName) name.getParent();
} }
@ -514,8 +514,7 @@ public class CPPSemantics {
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) parent.getParent(); ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) parent.getParent();
IASTName n = compSpec.getName(); IASTName n = compSpec.getName();
if (n instanceof ICPPASTQualifiedName) { if (n instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName)n).getNames(); n = ((ICPPASTQualifiedName) n).getLastName();
n = ns[ns.length - 1];
} }
scope = CPPVisitor.getContainingScope(n); scope = CPPVisitor.getContainingScope(n);
@ -1413,7 +1412,10 @@ public class CPPSemantics {
} }
} }
if (specName != null) { if (specName != null) {
if (!(specName instanceof ICPPASTQualifiedName) ||
data.astName == ((ICPPASTQualifiedName) specName).getLastName()) {
ASTInternal.addName(scope, specName); ASTInternal.addName(scope, specName);
}
if (nameMatches(data, specName, scope)) { if (nameMatches(data, specName, scope)) {
if (resultName == null) if (resultName == null)
resultName = specName; resultName = specName;
@ -1427,8 +1429,7 @@ public class CPPSemantics {
ICPPASTUsingDeclaration using = (ICPPASTUsingDeclaration) declaration; ICPPASTUsingDeclaration using = (ICPPASTUsingDeclaration) declaration;
IASTName name = using.getName(); IASTName name = using.getName();
if (name instanceof ICPPASTQualifiedName) { if (name instanceof ICPPASTQualifiedName) {
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames(); name = ((ICPPASTQualifiedName) name).getLastName();
name = ns[ns.length - 1];
} }
ASTInternal.addName(scope, name); ASTInternal.addName(scope, name);
if (nameMatches(data, name, scope)) { if (nameMatches(data, name, scope)) {
@ -1476,8 +1477,7 @@ public class CPPSemantics {
if (scope instanceof CPPScope == false || ((CPPScope) scope).canDenoteScopeMember(qname)) if (scope instanceof CPPScope == false || ((CPPScope) scope).canDenoteScopeMember(qname))
return false; return false;
final IASTName[] qn= qname.getNames(); potential= qname.getLastName();
potential= qn[qn.length-1];
} }
char[] c = potential.toCharArray(); char[] c = potential.toCharArray();
char[] n = data.name(); char[] n = data.name();