1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 07:55:24 +02:00

Code streamlining.

Change-Id: Iaafe325b1c984b4246bd80b3b80a4f08c612d32a
This commit is contained in:
Sergey Prigogin 2016-04-13 19:03:49 -07:00
parent a8d768376d
commit 739bc922cf
2 changed files with 11 additions and 12 deletions

View file

@ -24,20 +24,20 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
*/
public interface ICPPASTTemplateId extends ICPPASTName, IASTNameOwner {
/**
* TEMPLATE_NAME is the IASTName.
* The template name in the template ID.
*/
public static final ASTNodeProperty TEMPLATE_NAME = new ASTNodeProperty(
"ICPPASTTemplateId.TEMPLATE_NAME - TemplateId Name"); //$NON-NLS-1$
/**
* Get the name.
* Returns the name.
*
* @return {@code IASTName}
*/
public IASTName getTemplateName();
/**
* Set the name.
* Sets the name.
*
* @param name {@code IASTName}
*/
@ -50,9 +50,10 @@ public interface ICPPASTTemplateId extends ICPPASTName, IASTNameOwner {
"ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT - TemplateId Argument"); //$NON-NLS-1$
/**
* Constant.
* @deprecated Use IASTNode.EMPTY_NODE_ARRAY instead.
*/
public static final IASTNode[] EMPTY_ARG_ARRAY = {};
@Deprecated
public static final IASTNode[] EMPTY_ARG_ARRAY = IASTNode.EMPTY_NODE_ARRAY;
/**
* Adds template argument.

View file

@ -39,7 +39,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
*/
public class CPPASTTemplateId extends CPPASTNameBase implements ICPPASTTemplateId, IASTAmbiguityParent {
private IASTName templateName;
private IASTNode[] templateArguments;
private IASTNode[] templateArguments = IASTNode.EMPTY_NODE_ARRAY;
public CPPASTTemplateId() {
}
@ -91,7 +91,7 @@ public class CPPASTTemplateId extends CPPASTNameBase implements ICPPASTTemplateI
private void internalAddTemplateArgument(IASTNode node) {
assertNotFrozen();
templateArguments = ArrayUtil.append(IASTNode.class, templateArguments, node);
templateArguments = ArrayUtil.append(templateArguments, node);
if (node != null) {
node.setParent(this);
node.setPropertyInParent(TEMPLATE_ID_ARGUMENT);
@ -115,9 +115,7 @@ public class CPPASTTemplateId extends CPPASTNameBase implements ICPPASTTemplateI
@Override
public IASTNode[] getTemplateArguments() {
if (templateArguments == null)
return ICPPASTTemplateId.EMPTY_ARG_ARRAY;
return ArrayUtil.trim(IASTNode.class, templateArguments);
return ArrayUtil.trim(templateArguments);
}
@Override
@ -196,12 +194,12 @@ public class CPPASTTemplateId extends CPPASTNameBase implements ICPPASTTemplateI
@Override
public boolean isDeclaration() {
return false; //for now this seems to be true
return false; // For now this seems to be true.
}
@Override
public boolean isReference() {
return true; //for now this seems to be true
return true; // For now this seems to be true.
}
@Override