mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 322426 Add copy implementation to CPPASTAmbiguousTemplateArgument class for John Liu
This commit is contained in:
parent
1735b0d4ed
commit
8951c5d12b
2 changed files with 16 additions and 11 deletions
|
@ -85,7 +85,21 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
|
|||
|
||||
|
||||
public IASTNode copy() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
int sizeOfNodes = fNodes.size();
|
||||
IASTNode[] copyNodes = new IASTNode[sizeOfNodes];
|
||||
int arrayIndex = 0;
|
||||
for(IASTNode node : fNodes) {
|
||||
if(node!=null){
|
||||
copyNodes[arrayIndex]=node.copy();
|
||||
}else{
|
||||
copyNodes[arrayIndex]=null;
|
||||
}
|
||||
arrayIndex++;
|
||||
}
|
||||
|
||||
ICPPASTAmbiguousTemplateArgument ambiguityNode = new CPPASTAmbiguousTemplateArgument(copyNodes);
|
||||
return ambiguityNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -478,16 +478,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
IASTExpression expr = (IASTExpression) astStack.peek();
|
||||
|
||||
if(expr instanceof IASTIdExpression) {
|
||||
IASTName orgName =((IASTIdExpression)expr).getName();
|
||||
IASTName name = null;
|
||||
try{
|
||||
name = orgName.copy();
|
||||
//if there is node throws UnsupportedOperationException in copy, just use the original node
|
||||
} catch(UnsupportedOperationException ue){
|
||||
name = orgName;
|
||||
}
|
||||
|
||||
ParserUtil.setOffsetAndLength(name, expr);
|
||||
IASTName name = ((IASTIdExpression)expr).getName().copy();
|
||||
|
||||
IASTNamedTypeSpecifier declSpec = nodeFactory.newTypedefNameSpecifier(name);
|
||||
ParserUtil.setOffsetAndLength(declSpec, name);
|
||||
|
|
Loading…
Add table
Reference in a new issue