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

Bug 469023 - UnsupportedOperationException in CPPVisitor.createBinding

Change-Id: I10653fc6a23364d0977d3f7dc6e92b84812bf5bb
This commit is contained in:
Sergey Prigogin 2015-06-01 10:24:02 -07:00
parent aa463781be
commit f2e7ffec54

View file

@ -549,8 +549,9 @@ public class CPPVisitor extends ASTQueries {
}
}
if (scope instanceof ICPPClassScope && isFriend && !qualified) {
while (scope instanceof ICPPClassScope)
while (scope instanceof ICPPClassScope) {
scope = (ICPPScope) getParentScope(scope, elabType.getTranslationUnit());
}
}
if (scope != null) {
binding = scope.getBinding(elabType.getName(), false);
@ -2500,8 +2501,9 @@ public class CPPVisitor extends ASTQueries {
private static IScope getParentScope(IScope scope, IASTTranslationUnit unit) throws DOMException {
IScope parentScope= scope.getParent();
// the index cannot return the translation unit as parent scope
if (parentScope == null && scope instanceof IIndexScope && unit != null) {
// Replace the global scope from index with the global scope of the translation unit.
if ((parentScope == null || parentScope.getKind() == EScopeKind.eGlobal) &&
scope instanceof IIndexScope && unit != null) {
parentScope= unit.getScope();
}
return parentScope;