mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fixes bug that caused TeaVM compiler to freeze when compiling a certain
bytecode sequence
This commit is contained in:
parent
99c9617834
commit
25f4ad4b45
|
@ -381,16 +381,18 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
|||
cond.getConsequent().addAll(innerCond.getConsequent());
|
||||
cond.setCondition(Expr.binary(BinaryOperation.AND, cond.getCondition(),
|
||||
innerCond.getCondition()));
|
||||
} else {
|
||||
--i;
|
||||
} else if (cond.getAlternative().size() != 1 ||
|
||||
!(cond.getAlternative().get(0) instanceof ConditionalStatement)) {
|
||||
cond.setCondition(ExprOptimizer.invert(cond.getCondition()));
|
||||
cond.getConsequent().clear();
|
||||
cond.getConsequent().addAll(cond.getAlternative());
|
||||
cond.getAlternative().clear();
|
||||
cond.getAlternative().add(innerCond);
|
||||
}
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (stmt instanceof BlockStatement) {
|
||||
BlockStatement nestedBlock = (BlockStatement)stmt;
|
||||
eliminateRedundantBreaks(nestedBlock.getBody(), nestedBlock);
|
||||
|
|
Loading…
Reference in New Issue
Block a user