1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Fix for 176863, StackOverflow parsing ambigous template instanciation.

This commit is contained in:
Markus Schorn 2007-03-12 13:38:24 +00:00
parent 4eb3deed35
commit 1bc6b14d20
2 changed files with 10 additions and 1 deletions

View file

@ -40,7 +40,7 @@ public class CPPASTName extends CPPASTNode implements IASTName {
private static final char[] EMPTY_CHAR_ARRAY = {};
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final int MAX_RESOLUTION_DEPTH = 3;
private static final int MAX_RESOLUTION_DEPTH = 5;
private IBinding binding = null;
private int fResolutionDepth= 0;
@ -76,6 +76,12 @@ public class CPPASTName extends CPPASTNode implements IASTName {
return binding;
}
public void incResolutionDepth() {
if (binding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
binding= new RecursionResolvingBinding(this);
}
}
public IASTCompletionContext getCompletionContext() {
IASTNode node = getParent();
while (node != null) {

View file

@ -940,6 +940,9 @@ public class CPPVisitor {
IASTName ns [] = ((ICPPASTQualifiedName)name).getNames();
name = ns[ ns.length - 1 ];
}
if (name instanceof CPPASTName) {
((CPPASTName) name).incResolutionDepth();
}
IBinding binding = name.getBinding();
if( binding == null ){
binding = CPPSemantics.resolveBinding( name );