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

make sure template parameters have all their declarations added

This commit is contained in:
Andrew Niefer 2005-05-11 16:11:05 +00:00
parent cc677cd35b
commit 19b964b6f1
2 changed files with 11 additions and 6 deletions

View file

@ -176,6 +176,8 @@ public abstract class CPPTemplateDefinition implements ICPPTemplateDefinition, I
if( paramName.getBinding() != null ){
binding = paramName.getBinding();
name.setBinding( binding );
if( binding instanceof ICPPInternalBinding )
((ICPPInternalBinding)binding).addDeclaration( name );
return binding;
}
}
@ -198,8 +200,10 @@ public abstract class CPPTemplateDefinition implements ICPPTemplateDefinition, I
temp = template.getTemplateParameters()[i];
IASTName n = CPPTemplates.getTemplateParameterName( temp );
if( n != name ) {
if( n != name && n.getBinding() == null ) {
n.setBinding( binding );
if( binding instanceof ICPPInternalBinding )
((ICPPInternalBinding)binding).addDeclaration( n );
}
}

View file

@ -131,15 +131,16 @@ public class CPPTemplateParameter implements ICPPTemplateParameter, ICPPInternal
if( declarations == null )
declarations = new IASTName[] { name };
else {
if( declarations.length > 0 && declarations[0] == node )
return;
//keep the lowest offset declaration in [0]
if( declarations.length > 0 && ((ASTNode)node).getOffset() < ((ASTNode)declarations[0]).getOffset() ){
IASTName temp = declarations[0];
declarations[0] = name;
name = temp;
}
declarations = (IASTName[]) ArrayUtil.prepend( IASTName.class, declarations, name );
} else {
declarations = (IASTName[]) ArrayUtil.append( IASTName.class, declarations, name );
}
}
}
public void removeDeclaration(IASTNode node) {
if( declarations != null ) {
for (int i = 0; i < declarations.length; i++) {