mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 00:14:10 -08:00
Removes inlining of variable's values into && and || expression, as it
sometimes can violate evaluation order. Fixes creation of arrays of arrays of primitives.
This commit is contained in:
parent
bf68cf4b7d
commit
2f2985bb10
|
@ -45,6 +45,14 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(BinaryExpr expr) {
|
public void visit(BinaryExpr expr) {
|
||||||
|
switch (expr.getOperation()) {
|
||||||
|
case AND:
|
||||||
|
case OR:
|
||||||
|
resultExpr = expr;
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
expr.getSecondOperand().acceptVisitor(this);
|
expr.getSecondOperand().acceptVisitor(this);
|
||||||
Expr b = resultExpr;
|
Expr b = resultExpr;
|
||||||
expr.getFirstOperand().acceptVisitor(this);
|
expr.getFirstOperand().acceptVisitor(this);
|
||||||
|
|
|
@ -1149,9 +1149,6 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
public void visit(NewArrayExpr expr) {
|
public void visit(NewArrayExpr expr) {
|
||||||
try {
|
try {
|
||||||
ValueType type = expr.getType();
|
ValueType type = expr.getType();
|
||||||
while (type instanceof ValueType.Array) {
|
|
||||||
type = ((ValueType.Array)type).getItemType();
|
|
||||||
}
|
|
||||||
if (type instanceof ValueType.Primitive) {
|
if (type instanceof ValueType.Primitive) {
|
||||||
switch (((ValueType.Primitive)type).getKind()) {
|
switch (((ValueType.Primitive)type).getKind()) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user