Skip to content

Commit 92c9856

Browse files
hansonrhansonr
authored andcommitted
transpiler fix for int/byte missing numerator
1 parent 1043db3 commit 92c9856

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,7 @@ public boolean visit(InfixExpression node) {
30473047
return false;
30483048
String leftName = leftTypeBinding.getName();
30493049
String rightName = rightTypeBinding.getName();
3050+
30503051
boolean leftIsInt = leftTypeBinding.isPrimitive() && isIntegerType(leftName);
30513052
boolean rightIsInt = rightTypeBinding.isPrimitive() && isIntegerType(rightName);
30523053
if ("/".equals(operator) && leftIsInt && rightIsInt) {
@@ -4055,13 +4056,13 @@ private boolean addPrimitiveTypedExpression(Expression left, IVariableBinding as
40554056
}
40564057
break;
40574058
case "int":
4058-
if (op != null && (!isDiv && fromIntType) || fromChar || rightName.equals("short")
4059-
|| rightName.equals("byte")) {
4059+
if (!isDiv && (op != null && (!isDiv && fromIntType) || fromChar || rightName.equals("short")
4060+
|| rightName.equals("byte"))) {
40604061
left = null;
4061-
break;
4062+
} else {
4063+
more = "|0)";
4064+
addParens = true;
40624065
}
4063-
more = "|0)";
4064-
addParens = true;
40654066
break;
40664067
case "short":
40674068
if ((rightName.equals("short") || rightName.equals("byte")) && !isDiv) {

0 commit comments

Comments
 (0)