mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-06 16:45:25 +02:00
Bug 494489 - NPE in CPPASTCompoundStatementExpression.getEvaluation
Change-Id: Iff6243cee0e583af7b34681f123ba3016bfd6558
This commit is contained in:
parent
274b55c778
commit
b73b588611
1 changed files with 20 additions and 22 deletions
|
@ -35,26 +35,6 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
|
||||||
private ICPPEvaluation fEval;
|
private ICPPEvaluation fEval;
|
||||||
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
||||||
|
|
||||||
public CPPASTCompoundStatementExpression() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ICPPEvaluation getEvaluation() {
|
|
||||||
if (fEval == null) {
|
|
||||||
IASTCompoundStatement compound = getCompoundStatement();
|
|
||||||
IASTStatement[] statements = compound.getStatements();
|
|
||||||
if (statements.length > 0) {
|
|
||||||
IASTStatement st = statements[statements.length - 1];
|
|
||||||
if (st instanceof IASTExpressionStatement) {
|
|
||||||
fEval= new EvalCompound(((ICPPASTExpression) ((IASTExpressionStatement) st).getExpression()).getEvaluation(), this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fEval == null)
|
|
||||||
fEval= EvalFixed.INCOMPLETE;
|
|
||||||
}
|
|
||||||
return fEval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) {
|
public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) {
|
||||||
setCompoundStatement(statement);
|
setCompoundStatement(statement);
|
||||||
}
|
}
|
||||||
|
@ -66,8 +46,8 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTCompoundStatementExpression copy(CopyStyle style) {
|
public CPPASTCompoundStatementExpression copy(CopyStyle style) {
|
||||||
CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression();
|
CPPASTCompoundStatementExpression copy =
|
||||||
copy.setCompoundStatement(fStatement == null ? null : fStatement.copy(style));
|
new CPPASTCompoundStatementExpression(fStatement == null ? null : fStatement.copy(style));
|
||||||
return copy(copy, style);
|
return copy(copy, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +66,24 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICPPEvaluation getEvaluation() {
|
||||||
|
if (fEval == null) {
|
||||||
|
if (fStatement != null) {
|
||||||
|
IASTStatement[] statements = fStatement.getStatements();
|
||||||
|
if (statements.length > 0) {
|
||||||
|
IASTStatement st = statements[statements.length - 1];
|
||||||
|
if (st instanceof IASTExpressionStatement) {
|
||||||
|
fEval= new EvalCompound(((ICPPASTExpression) ((IASTExpressionStatement) st).getExpression()).getEvaluation(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fEval == null)
|
||||||
|
fEval= EvalFixed.INCOMPLETE;
|
||||||
|
}
|
||||||
|
return fEval;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
|
public IASTImplicitDestructorName[] getImplicitDestructorNames() {
|
||||||
if (fImplicitDestructorNames == null) {
|
if (fImplicitDestructorNames == null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue