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:
parent
cc677cd35b
commit
19b964b6f1
2 changed files with 11 additions and 6 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -131,13 +131,14 @@ public class CPPTemplateParameter implements ICPPTemplateParameter, ICPPInternal
|
|||
if( declarations == null )
|
||||
declarations = new IASTName[] { name };
|
||||
else {
|
||||
//keep the lowest offset declaration in [0]
|
||||
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 );
|
||||
}
|
||||
declarations = (IASTName[]) ArrayUtil.append( IASTName.class, declarations, name );
|
||||
}
|
||||
}
|
||||
public void removeDeclaration(IASTNode node) {
|
||||
|
|
Loading…
Add table
Reference in a new issue