dodgy code cleanup (Coverity)
This commit is contained in:
parent
ba6c711e85
commit
fc2dfcda96
|
@ -334,22 +334,19 @@ public class GrammarTransformPipeline {
|
|||
List<GrammarAST> rulesWeMoved = new ArrayList<GrammarAST>();
|
||||
GrammarASTWithOptions[] rules;
|
||||
if (combinedRulesRoot.getChildCount() > 0) {
|
||||
rules = ((List<?>)combinedRulesRoot.getChildren()).toArray(new GrammarASTWithOptions[0]);
|
||||
rules = combinedRulesRoot.getChildren().toArray(new GrammarASTWithOptions[0]);
|
||||
}
|
||||
else {
|
||||
rules = new GrammarASTWithOptions[0];
|
||||
}
|
||||
|
||||
if ( rules!=null ) {
|
||||
for (GrammarASTWithOptions r : rules) {
|
||||
String ruleName = r.getChild(0).getText();
|
||||
if (Grammar.isTokenName(ruleName)) {
|
||||
lexerRulesRoot.addChild((Tree)adaptor.dupTree(r));
|
||||
rulesWeMoved.add(r);
|
||||
}
|
||||
for (GrammarASTWithOptions r : rules) {
|
||||
String ruleName = r.getChild(0).getText();
|
||||
if (Grammar.isTokenName(ruleName)) {
|
||||
lexerRulesRoot.addChild((Tree)adaptor.dupTree(r));
|
||||
rulesWeMoved.add(r);
|
||||
}
|
||||
}
|
||||
int nLexicalRules = rulesWeMoved.size();
|
||||
for (GrammarAST r : rulesWeMoved) {
|
||||
combinedRulesRoot.deleteChild( r );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue