1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-02-26 17:07:56 -08:00
parent 71136d7739
commit 45fd24540c
3 changed files with 39 additions and 46 deletions

View file

@ -16,7 +16,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTReturnStatement extends IASTStatement {
public static final ASTNodeProperty RETURNVALUE = new ASTNodeProperty(
"IASTReturnValue.RETURNVALUE - [IASTInitializerClause]"); //$NON-NLS-1$

View file

@ -14,15 +14,13 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
/**
* This interface represents the try block statement. try { //body } catch( Exc
* e ) { // handler } catch( ... ) {
* }
* This interface represents the try block statement. try { //body } catch (Exc e )
* { // handler } catch ( ... ) { }
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTTryBlockStatement extends IASTStatement {
/**
* <code>BODY</code> is the body of the try block.
*/
@ -75,5 +73,4 @@ public interface ICPPASTTryBlockStatement extends IASTStatement {
*/
@Override
public ICPPASTTryBlockStatement copy(CopyStyle style);
}

View file

@ -24,7 +24,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockStatement, IASTAmbiguityParent {
private ICPPASTCatchHandler[] catchHandlers;
private int catchHandlersPos= -1;
private IASTStatement tryBody;
public CPPASTTryBlockStatement() {
}
@ -40,8 +42,8 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS
@Override
public CPPASTTryBlockStatement copy(CopyStyle style) {
CPPASTTryBlockStatement copy = new CPPASTTryBlockStatement(tryBody == null ? null
: tryBody.copy(style));
CPPASTTryBlockStatement copy =
new CPPASTTryBlockStatement(tryBody == null ? null : tryBody.copy(style));
for (ICPPASTCatchHandler handler : getCatchHandlers())
copy.addCatchHandler(handler == null ? null : handler.copy(style));
copy.setOffsetAndLength(this);
@ -61,19 +63,14 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS
}
}
@Override
public ICPPASTCatchHandler[] getCatchHandlers() {
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
if (catchHandlers == null)
return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
catchHandlers = ArrayUtil.trimAt(ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos);
return catchHandlers;
}
private ICPPASTCatchHandler [] catchHandlers = null;
private int catchHandlersPos=-1;
private IASTStatement tryBody;
@Override
public void setTryBody(IASTStatement tryBlock) {
assertNotFrozen();
@ -84,7 +81,6 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS
}
}
@Override
public IASTStatement getTryBody() {
return tryBody;
@ -99,11 +95,13 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS
default: break;
}
}
if( tryBody != null ) if( !tryBody.accept( action ) ) return false;
if (tryBody != null && !tryBody.accept(action))
return false;
ICPPASTCatchHandler[] handlers = getCatchHandlers();
for (int i = 0; i < handlers.length; i++) {
if( !handlers[i].accept( action ) ) return false;
if (!handlers[i].accept(action))
return false;
}
if (action.shouldVisitStatements) {
@ -118,8 +116,7 @@ public class CPPASTTryBlockStatement extends ASTNode implements ICPPASTTryBlockS
@Override
public void replace(IASTNode child, IASTNode other) {
if( tryBody == child )
{
if (tryBody == child) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
tryBody = (IASTStatement) other;