1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2016-05-24 14:05:32 -07:00
parent b91a639643
commit 25f52b35c9

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
@ -30,11 +30,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
/** /**
* Gnu-extension: ({ ... }) * Gnu-extension: ({ ... })
*/ */
public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUASTCompoundStatementExpression, ICPPASTExpression { public class CPPASTCompoundStatementExpression extends ASTNode
implements IGNUASTCompoundStatementExpression, ICPPASTExpression {
private IASTCompoundStatement fStatement; private IASTCompoundStatement fStatement;
private ICPPEvaluation fEval; private ICPPEvaluation fEval;
private IASTImplicitDestructorName[] fImplicitDestructorNames; private IASTImplicitDestructorName[] fImplicitDestructorNames;
public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) { public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) {
setCompoundStatement(statement); setCompoundStatement(statement);
} }
@ -43,7 +44,7 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
public CPPASTCompoundStatementExpression copy() { public CPPASTCompoundStatementExpression copy() {
return copy(CopyStyle.withoutLocations); return copy(CopyStyle.withoutLocations);
} }
@Override @Override
public CPPASTCompoundStatementExpression copy(CopyStyle style) { public CPPASTCompoundStatementExpression copy(CopyStyle style) {
CPPASTCompoundStatementExpression copy = CPPASTCompoundStatementExpression copy =
@ -72,9 +73,11 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
if (fStatement != null) { if (fStatement != null) {
IASTStatement[] statements = fStatement.getStatements(); IASTStatement[] statements = fStatement.getStatements();
if (statements.length > 0) { if (statements.length > 0) {
IASTStatement st = statements[statements.length - 1]; IASTStatement lastStatement = statements[statements.length - 1];
if (st instanceof IASTExpressionStatement) { if (lastStatement instanceof IASTExpressionStatement) {
fEval= new EvalCompound(((ICPPASTExpression) ((IASTExpressionStatement) st).getExpression()).getEvaluation(), this); ICPPASTExpression expression =
(ICPPASTExpression) ((IASTExpressionStatement) lastStatement).getExpression();
fEval= new EvalCompound(expression.getEvaluation(), this);
} }
} }
} }
@ -102,9 +105,10 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
default: break; default: break;
} }
} }
if (fStatement != null && !fStatement.accept(action)) return false; if (fStatement != null && !fStatement.accept(action))
return false;
if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action)) if (action.shouldVisitImplicitDestructorNames && !acceptByNodes(getImplicitDestructorNames(), action))
return false; return false;
@ -117,12 +121,12 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
} }
return true; return true;
} }
@Override @Override
public IType getExpressionType() { public IType getExpressionType() {
return getEvaluation().getType(this); return getEvaluation().getType(this);
} }
@Override @Override
public boolean isLValue() { public boolean isLValue() {
return false; return false;