mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
bug 126058: better handling of problem on the namespace alias
This commit is contained in:
parent
a830eb5ddd
commit
1390e00319
2 changed files with 26 additions and 1 deletions
|
@ -38,6 +38,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
|||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectSet;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.core.runtime.PlatformObject;
|
||||
|
||||
/**
|
||||
|
@ -54,6 +55,26 @@ public class CPPNamespace extends PlatformObject implements ICPPNamespace, ICPPI
|
|||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
return ((ICPPNamespace)getBinding()).getMemberBindings();
|
||||
}
|
||||
}
|
||||
public static class CPPNamespaceProblem extends ProblemBinding implements ICPPNamespace{
|
||||
public CPPNamespaceProblem( IASTNode node, int id, char[] arg ) {
|
||||
super( node, id, arg );
|
||||
}
|
||||
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
throw new DOMException(this);
|
||||
}
|
||||
}
|
||||
private static final char[] EMPTY_CHAR_ARRAY = { };
|
||||
|
||||
|
|
|
@ -436,7 +436,11 @@ public class CPPVisitor {
|
|||
binding = scope.getBinding( alias.getAlias(), false );
|
||||
if( binding == null ){
|
||||
IBinding namespace = alias.getMappingName().resolveBinding();
|
||||
if( namespace instanceof ICPPNamespace ){
|
||||
if( namespace instanceof IProblemBinding ){
|
||||
IProblemBinding problem = (IProblemBinding) namespace;
|
||||
namespace = new CPPNamespace.CPPNamespaceProblem( problem.getASTNode(), problem.getID(), alias.getMappingName().toCharArray());
|
||||
}
|
||||
if( namespace instanceof ICPPNamespace ) {
|
||||
binding = new CPPNamespaceAlias( alias.getAlias(), (ICPPNamespace) namespace );
|
||||
scope.addName( alias.getAlias() );
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue