mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 10:05:24 +02:00
Bug 351029: NPE resolving binding in copied AST.
This commit is contained in:
parent
4d758c0fc9
commit
5b93048496
1 changed files with 6 additions and 3 deletions
|
@ -1065,9 +1065,12 @@ public class CPPVisitor extends ASTQueries {
|
||||||
for (; i < names.length; i++) {
|
for (; i < names.length; i++) {
|
||||||
if (names[i] == name) break;
|
if (names[i] == name) break;
|
||||||
}
|
}
|
||||||
|
final IASTTranslationUnit tu = parent.getTranslationUnit();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (qname.isFullyQualified()) {
|
if (qname.isFullyQualified()) {
|
||||||
return parent.getTranslationUnit().getScope();
|
if (tu == null)
|
||||||
|
return null;
|
||||||
|
return tu.getScope();
|
||||||
}
|
}
|
||||||
if (qname.getParent() instanceof ICPPASTFieldReference) {
|
if (qname.getParent() instanceof ICPPASTFieldReference) {
|
||||||
name= qname;
|
name= qname;
|
||||||
|
@ -1091,8 +1094,8 @@ public class CPPVisitor extends ASTQueries {
|
||||||
boolean done= true;
|
boolean done= true;
|
||||||
IScope scope= null;
|
IScope scope= null;
|
||||||
if (binding instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
if (binding instanceof IIndexBinding) {
|
if (binding instanceof IIndexBinding && tu != null) {
|
||||||
binding= (((CPPASTTranslationUnit) parent.getTranslationUnit())).mapToAST((ICPPClassType) binding);
|
binding= (((CPPASTTranslationUnit) tu)).mapToAST((ICPPClassType) binding);
|
||||||
}
|
}
|
||||||
scope= ((ICPPClassType) binding).getCompositeScope();
|
scope= ((ICPPClassType) binding).getCompositeScope();
|
||||||
} else if (binding instanceof ICPPNamespace) {
|
} else if (binding instanceof ICPPNamespace) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue