1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-15 20:25:46 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-03-16 21:06:08 -07:00
parent 626c0cdaf3
commit c0486260cc
9 changed files with 78 additions and 92 deletions

View file

@ -17,8 +17,8 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTGotoStatement extends IASTStatement, IASTNameOwner { public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
public static final ASTNodeProperty NAME =
public static final ASTNodeProperty NAME = new ASTNodeProperty("IASTGotoStatement.NAME - Name for IASTGotoStatement"); //$NON-NLS-1$ new ASTNodeProperty("IASTGotoStatement.NAME - Name for IASTGotoStatement"); //$NON-NLS-1$
/** /**
* Returns the name of the label. The name resolves to a ILabel binding. * Returns the name of the label. The name resolves to a ILabel binding.
@ -46,5 +46,4 @@ public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
*/ */
@Override @Override
public IASTGotoStatement copy(CopyStyle style); public IASTGotoStatement copy(CopyStyle style);
} }

View file

@ -24,9 +24,7 @@ import org.eclipse.cdt.core.parser.IToken;
* @noextend This interface is not intended to be extended by clients. * @noextend This interface is not intended to be extended by clients.
*/ */
public interface IASTNode { public interface IASTNode {
/** /** @since 5.3 */
* @since 5.3
*/
public enum CopyStyle { public enum CopyStyle {
/** /**
* Copy without location, this copy is independent of the index and can be shared. * Copy without location, this copy is independent of the index and can be shared.

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CASTContinueStatement extends ASTNode implements IASTContinueStatement { public class CASTContinueStatement extends ASTNode implements IASTContinueStatement {
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {

View file

@ -23,11 +23,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CASTLabelStatement extends ASTNode implements IASTLabelStatement, IASTAmbiguityParent { public class CASTLabelStatement extends ASTNode implements IASTLabelStatement, IASTAmbiguityParent {
private IASTName name; private IASTName name;
private IASTStatement nestedStatement; private IASTStatement nestedStatement;
public CASTLabelStatement() { public CASTLabelStatement() {
} }
@ -77,8 +75,8 @@ public class CASTLabelStatement extends ASTNode implements IASTLabelStatement, I
default: break; default: break;
} }
} }
if( name != null ) if( !name.accept( action ) ) return false; if (name != null && !name.accept(action)) return false;
if( nestedStatement != null ) if( !nestedStatement.accept( action ) ) return false; if (nestedStatement != null && !nestedStatement.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
@ -89,10 +87,10 @@ public class CASTLabelStatement extends ASTNode implements IASTLabelStatement, I
return true; return true;
} }
@Override @Override
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if( n == name ) return r_declaration; if (n == name)
return r_declaration;
return r_unclear; return r_unclear;
} }
@ -113,12 +111,10 @@ public class CASTLabelStatement extends ASTNode implements IASTLabelStatement, I
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == nestedStatement ) if (child == nestedStatement) {
{
other.setParent(this); other.setParent(this);
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
setNestedStatement((IASTStatement) other); setNestedStatement((IASTStatement) other);
} }
} }
} }

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
* Represents a literal * Represents a literal
*/ */
public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpression { public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpression {
private int kind; private int kind;
private char[] value = CharArrayUtils.EMPTY; private char[] value = CharArrayUtils.EMPTY;

View file

@ -23,11 +23,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon * @author jcamelon
*/ */
public class CASTWhileStatement extends ASTNode implements IASTWhileStatement, IASTAmbiguityParent { public class CASTWhileStatement extends ASTNode implements IASTWhileStatement, IASTAmbiguityParent {
private IASTExpression condition; private IASTExpression condition;
private IASTStatement body; private IASTStatement body;
public CASTWhileStatement() { public CASTWhileStatement() {
} }
@ -92,8 +90,8 @@ public class CASTWhileStatement extends ASTNode implements IASTWhileStatement, I
default: break; default: break;
} }
} }
if( condition != null ) if( !condition.accept( action ) ) return false; if (condition != null && !condition.accept(action)) return false;
if( body != null ) if( !body.accept( action ) ) return false; if (body != null && !body.accept(action)) return false;
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -107,14 +105,12 @@ public class CASTWhileStatement extends ASTNode implements IASTWhileStatement, I
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( body == child ) if (body == child) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
body = (IASTStatement) other; body = (IASTStatement) other;
} }
if( child == condition ) if (child == condition) {
{
other.setPropertyInParent(child.getPropertyInParent()); other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent()); other.setParent(child.getParent());
condition = (IASTExpression) other; condition = (IASTExpression) other;

View file

@ -18,7 +18,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTContinueStatement extends ASTNode implements IASTContinueStatement { public class CPPASTContinueStatement extends ASTNode implements IASTContinueStatement {
@Override @Override
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) { if (action.shouldVisitStatements) {

View file

@ -1812,7 +1812,7 @@ public class CPPSemantics {
return new CPPCompositeBinding(result); return new CPPCompositeBinding(result);
} }
static public boolean declaredBefore(Object obj, IASTNode node, boolean indexBased) { public static boolean declaredBefore(Object obj, IASTNode node, boolean indexBased) {
if (node == null) if (node == null)
return true; return true;