@@ -121,7 +121,7 @@ public TextBuffer toJava(int indent) {
121
121
getInitExprent () instanceof AssignmentExprent init &&
122
122
init .getLeft () instanceof VarExprent varExpr &&
123
123
isIntegerType (varExpr .getExprType ()) &&
124
- init .getRight () instanceof ConstExprent constExpr &&
124
+ // init.getRight() instanceof ConstExprent constExpr &&
125
125
126
126
getIncExprent () instanceof FunctionExprent inc &&
127
127
inc .getFuncType ().isPPMM () &&
@@ -158,9 +158,17 @@ public TextBuffer toJava(int indent) {
158
158
}
159
159
}
160
160
161
- constExpr .setConstType (varExpr .getExprType ());
161
+ // constExpr.setConstType(varExpr.getExprType());
162
+ if (init .getRight () instanceof ConstExprent constExpr ) {
163
+ constExpr .setConstType (varExpr .getExprType ());
164
+ }
162
165
163
- if (constExpr .getValue () instanceof Integer i && i == 0 ) {
166
+ if (
167
+ inc .getFuncType ().isPP () &&
168
+ init .getRight () instanceof ConstExprent constExpr &&
169
+ constExpr .getValue () instanceof Integer i
170
+ && i == 0
171
+ ) {
164
172
buf .append ("repeat(" )
165
173
.append (conditionExpr .toJava ())
166
174
.append (") " );
@@ -189,7 +197,7 @@ public TextBuffer toJava(int indent) {
189
197
buf .append ("for (" )
190
198
.append (varExpr .toJava (indent ))
191
199
.append (" in " )
192
- .append (constExpr .toJava ())
200
+ .append (init . getRight () .toJava ())
193
201
.append (inc .getFuncType ().isPP () ? ".." : " downTo " )
194
202
.append (conditionExpr .toJava ())
195
203
.append (") {" )
0 commit comments