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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-01-16 22:50:14 +00:00
parent e07fbf49f5
commit e5c42af4c9
2 changed files with 79 additions and 80 deletions

View file

@ -36,7 +36,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.text.edits.TextEdit; import org.eclipse.text.edits.TextEdit;
public class CCodeFormatter extends CodeFormatter { public class CCodeFormatter extends CodeFormatter {
private DefaultCodeFormatterOptions preferences; private DefaultCodeFormatterOptions preferences;
private Map<String, ?> options; private Map<String, ?> options;
@ -78,8 +77,7 @@ public class CCodeFormatter extends CodeFormatter {
case DefaultCodeFormatterOptions.MIXED: case DefaultCodeFormatterOptions.MIXED:
int tabSize= preferences.tab_size; int tabSize= preferences.tab_size;
int spaceEquivalents= indentationLevel int spaceEquivalents= indentationLevel * preferences.indentation_size;
* preferences.indentation_size;
tabs= spaceEquivalents / tabSize; tabs= spaceEquivalents / tabSize;
spaces= spaceEquivalents % tabSize; spaces= spaceEquivalents % tabSize;
break; break;

View file

@ -336,31 +336,31 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
int indentLevel= scribe.indentationLevel; int indentLevel= scribe.indentationLevel;
try { try {
if (node instanceof IASTFunctionDefinition) { if (node instanceof IASTFunctionDefinition) {
return visit((IASTFunctionDefinition)node); return visit((IASTFunctionDefinition) node);
} else if (node instanceof IASTSimpleDeclaration) { } else if (node instanceof IASTSimpleDeclaration) {
return visit((IASTSimpleDeclaration)node); return visit((IASTSimpleDeclaration) node);
} else if (node instanceof IASTASMDeclaration) { } else if (node instanceof IASTASMDeclaration) {
return visit((IASTASMDeclaration)node); return visit((IASTASMDeclaration) node);
} else if (node instanceof ICPPASTVisibilityLabel) { } else if (node instanceof ICPPASTVisibilityLabel) {
return visit((ICPPASTVisibilityLabel)node); return visit((ICPPASTVisibilityLabel) node);
} else if (node instanceof ICPPASTNamespaceDefinition) { } else if (node instanceof ICPPASTNamespaceDefinition) {
return visit((ICPPASTNamespaceDefinition)node); return visit((ICPPASTNamespaceDefinition) node);
} else if (node instanceof ICPPASTNamespaceAlias) { } else if (node instanceof ICPPASTNamespaceAlias) {
return visit((ICPPASTNamespaceAlias)node); return visit((ICPPASTNamespaceAlias) node);
} else if (node instanceof ICPPASTUsingDeclaration) { } else if (node instanceof ICPPASTUsingDeclaration) {
return visit((ICPPASTUsingDeclaration)node); return visit((ICPPASTUsingDeclaration) node);
} else if (node instanceof ICPPASTUsingDirective) { } else if (node instanceof ICPPASTUsingDirective) {
return visit((ICPPASTUsingDirective)node); return visit((ICPPASTUsingDirective) node);
} else if (node instanceof ICPPASTLinkageSpecification) { } else if (node instanceof ICPPASTLinkageSpecification) {
return visit((ICPPASTLinkageSpecification)node); return visit((ICPPASTLinkageSpecification) node);
} else if (node instanceof ICPPASTTemplateDeclaration) { } else if (node instanceof ICPPASTTemplateDeclaration) {
return visit((ICPPASTTemplateDeclaration)node); return visit((ICPPASTTemplateDeclaration) node);
} else if (node instanceof ICPPASTTemplateSpecialization) { } else if (node instanceof ICPPASTTemplateSpecialization) {
return visit((ICPPASTTemplateSpecialization)node); return visit((ICPPASTTemplateSpecialization) node);
} else if (node instanceof ICPPASTExplicitTemplateInstantiation) { } else if (node instanceof ICPPASTExplicitTemplateInstantiation) {
return visit((ICPPASTExplicitTemplateInstantiation)node); return visit((ICPPASTExplicitTemplateInstantiation) node);
} else if (node instanceof IASTProblemDeclaration) { } else if (node instanceof IASTProblemDeclaration) {
return visit((IASTProblemDeclaration)node); return visit((IASTProblemDeclaration) node);
} else { } else {
formatRaw(node); formatRaw(node);
} }
@ -385,9 +385,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
try { try {
if (node instanceof ICPPASTQualifiedName) { if (node instanceof ICPPASTQualifiedName) {
visit((ICPPASTQualifiedName)node); visit((ICPPASTQualifiedName) node);
} else if (node instanceof ICPPASTTemplateId) { } else if (node instanceof ICPPASTTemplateId) {
visit((ICPPASTTemplateId)node); visit((ICPPASTTemplateId) node);
} else { } else {
formatRaw(node); formatRaw(node);
} }
@ -403,7 +403,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
@Override @Override
public int visit(IASTInitializer node) { public int visit(IASTInitializer node) {
if (node instanceof ICPPASTConstructorInitializer) { if (node instanceof ICPPASTConstructorInitializer) {
return visit((ICPPASTConstructorInitializer)node); return visit((ICPPASTConstructorInitializer) node);
} }
if (peekNextToken() == Token.tASSIGN) { if (peekNextToken() == Token.tASSIGN) {
@ -496,15 +496,15 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
if (node instanceof ICPPASTFunctionDeclarator) { if (node instanceof ICPPASTFunctionDeclarator) {
return visit((ICPPASTFunctionDeclarator)node); return visit((ICPPASTFunctionDeclarator) node);
} else if (node instanceof IASTStandardFunctionDeclarator) { } else if (node instanceof IASTStandardFunctionDeclarator) {
visit((IASTStandardFunctionDeclarator)node); visit((IASTStandardFunctionDeclarator) node);
} else if (node instanceof ICASTKnRFunctionDeclarator) { } else if (node instanceof ICASTKnRFunctionDeclarator) {
visit((ICASTKnRFunctionDeclarator)node); visit((ICASTKnRFunctionDeclarator) node);
} else if (node instanceof IASTFieldDeclarator) { } else if (node instanceof IASTFieldDeclarator) {
visit((IASTFieldDeclarator)node); visit((IASTFieldDeclarator) node);
} else if (node instanceof IASTArrayDeclarator) { } else if (node instanceof IASTArrayDeclarator) {
visit((IASTArrayDeclarator)node); visit((IASTArrayDeclarator) node);
} }
IASTInitializer initializer= node.getInitializer(); IASTInitializer initializer= node.getInitializer();
@ -540,17 +540,17 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
try { try {
if (node instanceof ICPPASTCompositeTypeSpecifier) { if (node instanceof ICPPASTCompositeTypeSpecifier) {
visit((ICPPASTCompositeTypeSpecifier)node); visit((ICPPASTCompositeTypeSpecifier) node);
} else if (node instanceof ICASTCompositeTypeSpecifier) { } else if (node instanceof ICASTCompositeTypeSpecifier) {
visit((ICASTCompositeTypeSpecifier)node); visit((ICASTCompositeTypeSpecifier) node);
} else if (node instanceof IASTElaboratedTypeSpecifier) { } else if (node instanceof IASTElaboratedTypeSpecifier) {
visit((IASTElaboratedTypeSpecifier)node); visit((IASTElaboratedTypeSpecifier) node);
} else if (node instanceof IASTEnumerationSpecifier) { } else if (node instanceof IASTEnumerationSpecifier) {
visit((IASTEnumerationSpecifier)node); visit((IASTEnumerationSpecifier) node);
} else if (node instanceof IASTSimpleDeclSpecifier) { } else if (node instanceof IASTSimpleDeclSpecifier) {
visit((IASTSimpleDeclSpecifier)node); visit((IASTSimpleDeclSpecifier) node);
} else if (node instanceof IASTNamedTypeSpecifier) { } else if (node instanceof IASTNamedTypeSpecifier) {
visit((IASTNamedTypeSpecifier)node); visit((IASTNamedTypeSpecifier) node);
} else { } else {
formatRaw(node); formatRaw(node);
} }
@ -568,37 +568,37 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
try { try {
if (node instanceof IASTArraySubscriptExpression) { if (node instanceof IASTArraySubscriptExpression) {
visit((IASTArraySubscriptExpression)node); visit((IASTArraySubscriptExpression) node);
} else if (node instanceof IASTConditionalExpression) { } else if (node instanceof IASTConditionalExpression) {
visit((IASTConditionalExpression)node); visit((IASTConditionalExpression) node);
} else if (node instanceof IASTFunctionCallExpression) { } else if (node instanceof IASTFunctionCallExpression) {
visit((IASTFunctionCallExpression)node); visit((IASTFunctionCallExpression) node);
} else if (node instanceof IASTExpressionList) { } else if (node instanceof IASTExpressionList) {
visit((IASTExpressionList)node); visit((IASTExpressionList) node);
} else if (node instanceof IASTTypeIdExpression) { } else if (node instanceof IASTTypeIdExpression) {
visit((IASTTypeIdExpression)node); visit((IASTTypeIdExpression) node);
} else if (node instanceof IASTBinaryExpression) { } else if (node instanceof IASTBinaryExpression) {
visit((IASTBinaryExpression)node); visit((IASTBinaryExpression) node);
} else if (node instanceof IASTLiteralExpression) { } else if (node instanceof IASTLiteralExpression) {
visit((IASTLiteralExpression)node); visit((IASTLiteralExpression) node);
} else if (node instanceof IASTIdExpression) { } else if (node instanceof IASTIdExpression) {
visit((IASTIdExpression)node); visit((IASTIdExpression) node);
} else if (node instanceof IASTCastExpression) { } else if (node instanceof IASTCastExpression) {
visit((IASTCastExpression)node); visit((IASTCastExpression) node);
} else if (node instanceof IASTUnaryExpression) { } else if (node instanceof IASTUnaryExpression) {
visit((IASTUnaryExpression)node); visit((IASTUnaryExpression) node);
} else if (node instanceof IASTFieldReference) { } else if (node instanceof IASTFieldReference) {
visit((IASTFieldReference)node); visit((IASTFieldReference) node);
} else if (node instanceof ICASTTypeIdInitializerExpression) { } else if (node instanceof ICASTTypeIdInitializerExpression) {
visit((ICASTTypeIdInitializerExpression)node); visit((ICASTTypeIdInitializerExpression) node);
} else if (node instanceof ICPPASTNewExpression) { } else if (node instanceof ICPPASTNewExpression) {
visit((ICPPASTNewExpression)node); visit((ICPPASTNewExpression) node);
} else if (node instanceof ICPPASTDeleteExpression) { } else if (node instanceof ICPPASTDeleteExpression) {
visit((ICPPASTDeleteExpression)node); visit((ICPPASTDeleteExpression) node);
} else if (node instanceof ICPPASTSimpleTypeConstructorExpression) { } else if (node instanceof ICPPASTSimpleTypeConstructorExpression) {
visit((ICPPASTSimpleTypeConstructorExpression)node); visit((ICPPASTSimpleTypeConstructorExpression) node);
} else if (node instanceof IASTProblemExpression) { } else if (node instanceof IASTProblemExpression) {
visit((IASTProblemExpression)node); visit((IASTProblemExpression) node);
} else { } else {
formatRaw(node); formatRaw(node);
} }
@ -617,43 +617,43 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
int indentLevel= scribe.indentationLevel; int indentLevel= scribe.indentationLevel;
try { try {
if (node instanceof IASTCompoundStatement) { if (node instanceof IASTCompoundStatement) {
visit((IASTCompoundStatement)node); visit((IASTCompoundStatement) node);
} else if (node instanceof IASTNullStatement) { } else if (node instanceof IASTNullStatement) {
visit((IASTNullStatement)node); visit((IASTNullStatement) node);
} else if (node instanceof IASTDeclarationStatement) { } else if (node instanceof IASTDeclarationStatement) {
visit((IASTDeclarationStatement)node); visit((IASTDeclarationStatement) node);
} else if (node instanceof IASTForStatement) { } else if (node instanceof IASTForStatement) {
visit((IASTForStatement)node); visit((IASTForStatement) node);
} else if (node instanceof ICPPASTRangeBasedForStatement) { } else if (node instanceof ICPPASTRangeBasedForStatement) {
visit((ICPPASTRangeBasedForStatement) node); visit((ICPPASTRangeBasedForStatement) node);
} else if (node instanceof IASTIfStatement) { } else if (node instanceof IASTIfStatement) {
visit((IASTIfStatement)node); visit((IASTIfStatement) node);
} else if (node instanceof ICPPASTCatchHandler) { } else if (node instanceof ICPPASTCatchHandler) {
visit((ICPPASTCatchHandler)node); visit((ICPPASTCatchHandler) node);
} else if (node instanceof ICPPASTTryBlockStatement) { } else if (node instanceof ICPPASTTryBlockStatement) {
visit((ICPPASTTryBlockStatement)node); visit((ICPPASTTryBlockStatement) node);
} else if (node instanceof IASTWhileStatement) { } else if (node instanceof IASTWhileStatement) {
visit((IASTWhileStatement)node); visit((IASTWhileStatement) node);
} else if (node instanceof IASTDoStatement) { } else if (node instanceof IASTDoStatement) {
visit((IASTDoStatement)node); visit((IASTDoStatement) node);
} else if (node instanceof IASTSwitchStatement) { } else if (node instanceof IASTSwitchStatement) {
visit((IASTSwitchStatement)node); visit((IASTSwitchStatement) node);
} else if (node instanceof IASTExpressionStatement) { } else if (node instanceof IASTExpressionStatement) {
visit((IASTExpressionStatement)node); visit((IASTExpressionStatement) node);
} else if (node instanceof IASTContinueStatement) { } else if (node instanceof IASTContinueStatement) {
visit((IASTContinueStatement)node); visit((IASTContinueStatement) node);
} else if (node instanceof IASTReturnStatement) { } else if (node instanceof IASTReturnStatement) {
visit((IASTReturnStatement)node); visit((IASTReturnStatement) node);
} else if (node instanceof IASTBreakStatement) { } else if (node instanceof IASTBreakStatement) {
visit((IASTBreakStatement)node); visit((IASTBreakStatement) node);
} else if (node instanceof IASTCaseStatement) { } else if (node instanceof IASTCaseStatement) {
visit((IASTCaseStatement)node); visit((IASTCaseStatement) node);
} else if (node instanceof IASTDefaultStatement) { } else if (node instanceof IASTDefaultStatement) {
visit((IASTDefaultStatement)node); visit((IASTDefaultStatement) node);
} else if (node instanceof IASTLabelStatement) { } else if (node instanceof IASTLabelStatement) {
visit((IASTLabelStatement)node); visit((IASTLabelStatement) node);
} else if (node instanceof IASTProblemStatement) { } else if (node instanceof IASTProblemStatement) {
visit((IASTProblemStatement)node); visit((IASTProblemStatement) node);
} else { } else {
formatRaw(node); formatRaw(node);
} }
@ -680,7 +680,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
try { try {
if (node instanceof IASTProblemHolder) { if (node instanceof IASTProblemHolder) {
throw new ASTProblemException(((IASTProblemHolder)node).getProblem()); throw new ASTProblemException(((IASTProblemHolder) node).getProblem());
} }
// decl-specifier // decl-specifier
final IASTDeclSpecifier declSpec= node.getDeclSpecifier(); final IASTDeclSpecifier declSpec= node.getDeclSpecifier();
@ -888,11 +888,11 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (!startNode(node)) { return PROCESS_SKIP; } if (!startNode(node)) { return PROCESS_SKIP; }
try { try {
if (node instanceof ICPPASTSimpleTypeTemplateParameter) { if (node instanceof ICPPASTSimpleTypeTemplateParameter) {
visit((ICPPASTSimpleTypeTemplateParameter)node); visit((ICPPASTSimpleTypeTemplateParameter) node);
} else if (node instanceof ICPPASTTemplatedTypeTemplateParameter) { } else if (node instanceof ICPPASTTemplatedTypeTemplateParameter) {
visit((ICPPASTTemplatedTypeTemplateParameter)node); visit((ICPPASTTemplatedTypeTemplateParameter) node);
} else { } else {
visit((IASTParameterDeclaration)node); visit((IASTParameterDeclaration) node);
} }
} catch (ASTProblemException e) { } catch (ASTProblemException e) {
skipNode(node); skipNode(node);
@ -1045,7 +1045,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
scribe.startNewLine(); scribe.startNewLine();
if (node instanceof ICPPASTFunctionWithTryBlock) { if (node instanceof ICPPASTFunctionWithTryBlock) {
ICPPASTCatchHandler[] catchHandlers= ((ICPPASTFunctionWithTryBlock)node).getCatchHandlers(); ICPPASTCatchHandler[] catchHandlers= ((ICPPASTFunctionWithTryBlock) node).getCatchHandlers();
for (ICPPASTCatchHandler catchHandler : catchHandlers) { for (ICPPASTCatchHandler catchHandler : catchHandlers) {
catchHandler.accept(this); catchHandler.accept(this);
scribe.printTrailingComment(); scribe.printTrailingComment();
@ -1062,7 +1062,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
private int visit(ICPPASTFunctionDeclarator node) { private int visit(ICPPASTFunctionDeclarator node) {
visit((IASTStandardFunctionDeclarator)node); visit((IASTStandardFunctionDeclarator) node);
boolean needSpace = skipConstVolatileRestrict(); boolean needSpace = skipConstVolatileRestrict();
@ -1375,7 +1375,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
scribe.space(); scribe.space();
} }
if (node instanceof ICPPASTNamedTypeSpecifier) { if (node instanceof ICPPASTNamedTypeSpecifier) {
if (((ICPPASTNamedTypeSpecifier)node).isTypename()) { if (((ICPPASTNamedTypeSpecifier) node).isTypename()) {
scribe.printNextToken(Token.t_typename); scribe.printNextToken(Token.t_typename);
scribe.space(); scribe.space();
} }
@ -1714,7 +1714,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
final IASTNode node= elements.get(i); final IASTNode node= elements.get(i);
if (node instanceof ICPPASTConstructorChainInitializer) { if (node instanceof ICPPASTConstructorChainInitializer) {
// this is a special case // this is a special case
visit((ICPPASTConstructorChainInitializer)node); visit((ICPPASTConstructorChainInitializer) node);
} else { } else {
node.accept(this); node.accept(this);
} }
@ -2318,7 +2318,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
scribe.space(); scribe.space();
} }
if (node instanceof ICPPASTFieldReference) { if (node instanceof ICPPASTFieldReference) {
if (((ICPPASTFieldReference)node).isTemplate()) { if (((ICPPASTFieldReference) node).isTemplate()) {
scribe.printNextToken(Token.t_template); scribe.printNextToken(Token.t_template);
scribe.space(); scribe.space();
} }
@ -2533,7 +2533,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
condition.accept(this); condition.accept(this);
} else if (node instanceof ICPPASTForStatement) { } else if (node instanceof ICPPASTForStatement) {
final IASTDeclaration conditionDecl = ((ICPPASTForStatement)node).getConditionDeclaration(); final IASTDeclaration conditionDecl = ((ICPPASTForStatement) node).getConditionDeclaration();
if (conditionDecl != null) { if (conditionDecl != null) {
if (preferences.insert_space_after_semicolon_in_for) { if (preferences.insert_space_after_semicolon_in_for) {
scribe.space(); scribe.space();
@ -2893,7 +2893,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
statement.accept(this); statement.accept(this);
if (preferences.indent_breaks_compare_to_cases) { if (preferences.indent_breaks_compare_to_cases) {
if(!preferences.indent_switchstatements_compare_to_cases) { if (!preferences.indent_switchstatements_compare_to_cases) {
scribe.unIndent(); scribe.unIndent();
} }
} else if (preferences.indent_switchstatements_compare_to_cases) { } else if (preferences.indent_switchstatements_compare_to_cases) {
@ -2992,7 +2992,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (condition != null) { if (condition != null) {
condition.accept(this); condition.accept(this);
} else if (node instanceof ICPPASTWhileStatement) { } else if (node instanceof ICPPASTWhileStatement) {
final IASTDeclaration conditionDecl= ((ICPPASTWhileStatement)node).getConditionDeclaration(); final IASTDeclaration conditionDecl= ((ICPPASTWhileStatement) node).getConditionDeclaration();
if (conditionDecl != null) { if (conditionDecl != null) {
conditionDecl.accept(this); conditionDecl.accept(this);
} }
@ -3397,7 +3397,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
private boolean commentStartsBlock(int start, int end) { private boolean commentStartsBlock(int start, int end) {
localScanner.resetTo(start, end); localScanner.resetTo(start, end);
if (localScanner.getNextToken() == Token.tLBRACE) { if (localScanner.getNextToken() == Token.tLBRACE) {
switch(localScanner.getNextToken()) { switch (localScanner.getNextToken()) {
case Token.tBLOCKCOMMENT : case Token.tBLOCKCOMMENT :
case Token.tLINECOMMENT : case Token.tLINECOMMENT :
return true; return true;
@ -3419,14 +3419,15 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
private int peekNextToken() { private int peekNextToken() {
return peekNextToken(false); return peekNextToken(false);
} }
private int peekNextToken(boolean ignoreSkip) { private int peekNextToken(boolean ignoreSkip) {
if (!ignoreSkip && scribe.shouldSkip(scribe.scanner.getCurrentPosition())) { if (!ignoreSkip && scribe.shouldSkip(scribe.scanner.getCurrentPosition())) {
return Token.tBADCHAR; return Token.tBADCHAR;
} }
localScanner.resetTo(scribe.scanner.getCurrentPosition(), scribe.scannerEndPosition - 1); localScanner.resetTo(scribe.scanner.getCurrentPosition(), scribe.scannerEndPosition - 1);
int token = localScanner.getNextToken(); int token = localScanner.getNextToken();
loop: while(true) { loop: while (true) {
switch(token) { switch (token) {
case Token.tBLOCKCOMMENT : case Token.tBLOCKCOMMENT :
case Token.tLINECOMMENT : case Token.tLINECOMMENT :
token = localScanner.getNextToken(); token = localScanner.getNextToken();
@ -3448,7 +3449,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (commentStartsBlock(blockStartPosition, blockLength)) return false; if (commentStartsBlock(blockStartPosition, blockLength)) return false;
final int statementsLength = statements.size(); final int statementsLength = statements.size();
if (statementsLength != 1) return false; if (statementsLength != 1) return false;
if(statements.get(0) instanceof IASTReturnStatement) { if (statements.get(0) instanceof IASTReturnStatement) {
return true; return true;
} }
return false; return false;