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

Bug 299911. Fixed propagation of template instantiation context.

This commit is contained in:
Sergey Prigogin 2012-08-09 10:47:52 -07:00
parent a7f7ee8abe
commit e9b0ab84db

View file

@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
@ -74,10 +75,13 @@ class BaseClassLookup {
private boolean fPropagationDone; private boolean fPropagationDone;
private boolean fCollected; private boolean fCollected;
private boolean fCollectedAsRegularBase; private boolean fCollectedAsRegularBase;
private final IASTNode fLookupPoint;
private BaseClassLookup(ICPPClassType type) { private BaseClassLookup(ICPPClassType type, IASTNode lookupPoint) {
fClassType= type; fClassType= type;
fLookupPoint= lookupPoint;
} }
ICPPClassType getClassType() { ICPPClassType getClassType() {
return fClassType; return fClassType;
} }
@ -161,10 +165,10 @@ class BaseClassLookup {
BaseClassLookup result; BaseClassLookup result;
IBinding[] matches= IBinding.EMPTY_BINDING_ARRAY; IBinding[] matches= IBinding.EMPTY_BINDING_ARRAY;
if (baseClassScope == null) { if (baseClassScope == null) {
result= new BaseClassLookup(root); result= new BaseClassLookup(root, data.getLookupPoint());
infoMap.put(root.getCompositeScope(), result); infoMap.put(root.getCompositeScope(), result);
} else { } else {
result= new BaseClassLookup(baseClassScope.getClassType()); result= new BaseClassLookup(baseClassScope.getClassType(), data.getLookupPoint());
infoMap.put(baseClassScope, result); infoMap.put(baseClassScope, result);
try { try {
IBinding[] members= CPPSemantics.getBindingsFromScope(baseClassScope, data); IBinding[] members= CPPSemantics.getBindingsFromScope(baseClassScope, data);
@ -288,7 +292,7 @@ class BaseClassLookup {
if (fClassType != null) { if (fClassType != null) {
ICPPBase[] bases= null; ICPPBase[] bases= null;
bases= fClassType.getBases(); bases= ClassTypeHelper.getBases(fClassType, fLookupPoint);
if (bases != null && bases.length > 0) { if (bases != null && bases.length > 0) {
for (ICPPBase base : bases) { for (ICPPBase base : bases) {
IBinding baseBinding = base.getBaseClass(); IBinding baseBinding = base.getBaseClass();
@ -309,7 +313,7 @@ class BaseClassLookup {
baseInfo.propagateHiddenAsVirtual(); baseInfo.propagateHiddenAsVirtual();
} else { } else {
// mark to catch recursions // mark to catch recursions
baseInfo= new BaseClassLookup(baseClass); baseInfo= new BaseClassLookup(baseClass, fLookupPoint);
infoMap.put(baseScope, baseInfo); infoMap.put(baseScope, baseInfo);
baseInfo.hideVirtualBases(infoMap, depth); baseInfo.hideVirtualBases(infoMap, depth);
} }