mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 08:24:10 -08:00
JS: fix operator priority when rendering new
expression
This commit is contained in:
parent
9364ad943a
commit
2e20287f80
|
@ -1137,8 +1137,19 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor {
|
||||||
if (expr.getLocation() != null) {
|
if (expr.getLocation() != null) {
|
||||||
pushLocation(expr.getLocation());
|
pushLocation(expr.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Precedence outerPrecedence = precedence;
|
||||||
|
if (outerPrecedence.ordinal() > Precedence.FUNCTION_CALL.ordinal()) {
|
||||||
|
writer.append('(');
|
||||||
|
}
|
||||||
|
|
||||||
precedence = Precedence.FUNCTION_CALL;
|
precedence = Precedence.FUNCTION_CALL;
|
||||||
|
|
||||||
writer.append("new ").append(naming.getNameFor(expr.getConstructedClass()));
|
writer.append("new ").append(naming.getNameFor(expr.getConstructedClass()));
|
||||||
|
if (outerPrecedence.ordinal() > Precedence.FUNCTION_CALL.ordinal()) {
|
||||||
|
writer.append(')');
|
||||||
|
}
|
||||||
|
|
||||||
if (expr.getLocation() != null) {
|
if (expr.getLocation() != null) {
|
||||||
popLocation();
|
popLocation();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user