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

Fixed a typo.

This commit is contained in:
Sergey Prigogin 2010-03-01 05:14:49 +00:00
parent af930f51f9
commit a71b6c6659
6 changed files with 96 additions and 84 deletions

View file

@ -44,14 +44,14 @@ public interface ICPPASTTemplateDeclaration extends IASTDeclaration {
"ICPPASTTemplateDeclaration.OWNED_DECLARATION - Subdeclaration maintained grammatically"); //$NON-NLS-1$ "ICPPASTTemplateDeclaration.OWNED_DECLARATION - Subdeclaration maintained grammatically"); //$NON-NLS-1$
/** /**
* Get templated declaration. * Get template declaration.
* *
* @return <code>IASTDeclaration</code> * @return <code>IASTDeclaration</code>
*/ */
public IASTDeclaration getDeclaration(); public IASTDeclaration getDeclaration();
/** /**
* Set the templated declaration. * Set the template declaration.
* *
* @param declaration * @param declaration
* <code>IASTDeclaration</code> * <code>IASTDeclaration</code>
@ -74,9 +74,15 @@ public interface ICPPASTTemplateDeclaration extends IASTDeclaration {
/** /**
* Add a template parameter. * Add a template parameter.
* *
* @param parm * @param parm <code>ICPPASTTemplateParameter</code>
* <code>ICPPASTTemplateParameter</code> * @since 5.2
*/ */
public void addTemplateParameter(ICPPASTTemplateParameter parm);
/**
* @deprecated Use addTemplateParameter.
*/
@Deprecated
public void addTemplateParamter(ICPPASTTemplateParameter parm); public void addTemplateParamter(ICPPASTTemplateParameter parm);
/** /**

View file

@ -32,7 +32,8 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
private short nestingLevel= -1; private short nestingLevel= -1;
private IASTDeclaration declaration; private IASTDeclaration declaration;
private ICPPTemplateScope templateScope; private ICPPTemplateScope templateScope;
private ICPPASTTemplateParameter[] parameters = null;
private int parametersPos= -1;
public CPPASTTemplateDeclaration() { public CPPASTTemplateDeclaration() {
} }
@ -46,7 +47,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
copy.setDeclaration(declaration == null ? null : declaration.copy()); copy.setDeclaration(declaration == null ? null : declaration.copy());
copy.exported = exported; copy.exported = exported;
for (ICPPASTTemplateParameter param : getTemplateParameters()) for (ICPPASTTemplateParameter param : getTemplateParameters())
copy.addTemplateParamter(param == null ? null : param.copy()); copy.addTemplateParameter(param == null ? null : param.copy());
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
return copy; return copy;
} }
@ -79,7 +80,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
return parameters; return parameters;
} }
public void addTemplateParamter(ICPPASTTemplateParameter parm) { public void addTemplateParameter(ICPPASTTemplateParameter parm) {
assertNotFrozen(); assertNotFrozen();
if (parm != null) { if (parm != null) {
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm); parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append(ICPPASTTemplateParameter.class, parameters, ++parametersPos, parm);
@ -88,8 +89,11 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
} }
} }
private ICPPASTTemplateParameter [] parameters = null; @Deprecated
private int parametersPos=-1; public void addTemplateParamter(ICPPASTTemplateParameter param) {
addTemplateParameter(param);
}
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
@ -105,7 +109,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
if (!params[i].accept(action)) return false; if (!params[i].accept(action)) return false;
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if (declaration != null && !declaration.accept(action)) return false;
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -124,8 +128,7 @@ public class CPPASTTemplateDeclaration extends ASTNode implements
} }
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( declaration == child ) if (declaration == child) {
{
other.setParent(child.getParent()); other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
declaration = (IASTDeclaration) other; declaration = (IASTDeclaration) other;

View file

@ -70,7 +70,7 @@ public class CPPASTTemplateSpecialization extends ASTNode implements
} }
} }
if( declaration != null ) if( !declaration.accept( action ) ) return false; if (declaration != null && !declaration.accept(action)) return false;
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -94,10 +94,15 @@ public class CPPASTTemplateSpecialization extends ASTNode implements
return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY; return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
} }
public void addTemplateParamter(ICPPASTTemplateParameter parm) { public void addTemplateParameter(ICPPASTTemplateParameter param) {
assertNotFrozen(); assertNotFrozen();
} }
@Deprecated
public void addTemplateParamter(ICPPASTTemplateParameter param) {
addTemplateParameter(param);
}
public ICPPTemplateScope getScope() { public ICPPTemplateScope getScope() {
if (templateScope == null) if (templateScope == null)
templateScope = new CPPTemplateScope(this); templateScope = new CPPTemplateScope(this);

View file

@ -1640,7 +1640,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
templateDecl.setExported(exported); templateDecl.setExported(exported);
for (int i = 0; i < parms.size(); ++i) { for (int i = 0; i < parms.size(); ++i) {
ICPPASTTemplateParameter parm = parms.get(i); ICPPASTTemplateParameter parm = parms.get(i);
templateDecl.addTemplateParamter(parm); templateDecl.addTemplateParameter(parm);
} }
return templateDecl; return templateDecl;
} }
@ -4005,8 +4005,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
(switch_body != null ? calculateEndOffset(switch_body) : LA(1).getEndOffset()) - startOffset); (switch_body != null ? calculateEndOffset(switch_body) : LA(1).getEndOffset()) - startOffset);
if (switch_condition instanceof IASTExpression) { if (switch_condition instanceof IASTExpression) {
switch_statement.setControllerExpression((IASTExpression) switch_condition); switch_statement.setControllerExpression((IASTExpression) switch_condition);
} } else if (switch_condition instanceof IASTDeclaration) {
else if( switch_condition instanceof IASTDeclaration ) {
switch_statement.setControllerDeclaration((IASTDeclaration) switch_condition); switch_statement.setControllerDeclaration((IASTDeclaration) switch_condition);
} }
@ -4068,8 +4067,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (for_condition != null) { if (for_condition != null) {
if (for_condition instanceof IASTExpression) { if (for_condition instanceof IASTExpression) {
for_statement.setConditionExpression((IASTExpression) for_condition); for_statement.setConditionExpression((IASTExpression) for_condition);
} } else if (for_condition instanceof IASTDeclaration) {
else if( for_condition instanceof IASTDeclaration ) {
for_statement.setConditionDeclaration((IASTDeclaration) for_condition); for_statement.setConditionDeclaration((IASTDeclaration) for_condition);
} }
} }

View file

@ -673,7 +673,7 @@ public class ExtractFunctionRefactoring extends CRefactoring {
templateDeclaration.setParent(unit); templateDeclaration.setParent(unit);
for(ICPPASTTemplateParameter templateParameter : ((ICPPASTTemplateDeclaration) insertpoint.getParent()).getTemplateParameters()) { for(ICPPASTTemplateParameter templateParameter : ((ICPPASTTemplateDeclaration) insertpoint.getParent()).getTemplateParameters()) {
templateDeclaration.addTemplateParamter(templateParameter.copy()); templateDeclaration.addTemplateParameter(templateParameter.copy());
} }
templateDeclaration.setDeclaration(func); templateDeclaration.setDeclaration(func);

View file

@ -232,7 +232,7 @@ public class ImplementMethodRefactoring extends CRefactoring {
templateDeclaration.setParent(unit); templateDeclaration.setParent(unit);
for(ICPPASTTemplateParameter templateParameter : ((ICPPASTTemplateDeclaration) declarationParent.getParent().getParent() ).getTemplateParameters()) { for(ICPPASTTemplateParameter templateParameter : ((ICPPASTTemplateDeclaration) declarationParent.getParent().getParent() ).getTemplateParameters()) {
templateDeclaration.addTemplateParamter(templateParameter.copy()); templateDeclaration.addTemplateParameter(templateParameter.copy());
} }
templateDeclaration.setDeclaration(func); templateDeclaration.setDeclaration(func);