Debian Codegraph @

framework/tests/all-systems/CompoundAssignments.java

raw
1 class CompoundAssignments {
2 static final int SIZE = 4;
3
4 // There used to be a bug creating the LeftShiftAssignmentNode
5 // where the target (e.g. pow) was replaced by the shift amount
6 // (e.g. 1).
7 static void left_shift_assign() {
8 for (int i = 0, pow = 1; i <= SIZE; i++) {
9 pow <<= 1;
10 }
11 }
12
13 // There used to be a bug computing the Receiver for a widening
14 // conversion, such as widening sum to a double below.
15 static int sum_with_widening() {
16 double[] freq = new double[SIZE];
17 int sum = 0;
18 for (int i = 0; i < SIZE; i++) {
19 sum += freq[i];
20 }
21 return sum;
22 }
23 }