mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Refactoring:
- Merged declaration an initialization of result variable in initializerList, as conditional initialization is executed exactly once, unless a parse exception occurs. - Removed dead code: Conditional return. Change-Id: Ia8c2bcb5f76a56d6b71ad80095a546ebd4f9ac03
This commit is contained in:
parent
fae217d744
commit
db70bb0f29
1 changed files with 1 additions and 8 deletions
|
@ -3546,7 +3546,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
*/
|
*/
|
||||||
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException,
|
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException,
|
||||||
BacktrackException {
|
BacktrackException {
|
||||||
List<IASTInitializerClause> result= null;
|
List<IASTInitializerClause> result= new ArrayList<IASTInitializerClause>();
|
||||||
// List of initializer clauses
|
// List of initializer clauses
|
||||||
loop: while (true) {
|
loop: while (true) {
|
||||||
// Clause may be null, add to initializer anyways, such that the size can be computed.
|
// Clause may be null, add to initializer anyways, such that the size can be computed.
|
||||||
|
@ -3563,9 +3563,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
clause= setRange(packExpansion, clause, endOffset);
|
clause= setRange(packExpansion, clause, endOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == null) {
|
|
||||||
result= new ArrayList<IASTInitializerClause>();
|
|
||||||
}
|
|
||||||
result.add(clause);
|
result.add(clause);
|
||||||
if (LT(1) != IToken.tCOMMA)
|
if (LT(1) != IToken.tCOMMA)
|
||||||
break;
|
break;
|
||||||
|
@ -3577,10 +3574,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
consume(IToken.tCOMMA);
|
consume(IToken.tCOMMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null)
|
|
||||||
return Collections.emptyList();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue