Files
sdk/tests/isolate
Jens Johansen 2e75b6cce9 [kernel] Fix closure in for loop
In kernel the loop level wasn't set correctly for for loops, resulting
in the loop variable not always being fresh.

Examples:

```
  // Capture the loop variable, ensure we capture the right value.
  for (int i = 0; i < 10; i++) { if (i == 7) f = () => "i = $i"; }

  print(f());
  // There is only one instance of k. The captured variable continues to change.
  int k;
  for (k = 0; k < 10; k++) { if (k == 7) f = () => "k = $k"; }
  print(f());
```

resulted in
i = 10
k = 10

(i.e. it's wrong)

whereas

```
  // Capture the loop variable, ensure we capture the right value.
  for (int i = 0; i < 10; i++) { if (i == 7) { f = () => "i = $i"; } }
  print(f());
  {
    // There is only one instance of k. The captured variable continues to change.
    int k;
    for (k = 0; k < 10; k++) { if (k == 7) { f = () => "k = $k"; } }
    print(f());
  }
```

resultet in

i = 7
k = 10

(i.e. it's correct).

Now both examples produce the correct result.

Change-Id: I1fb4c888c6a0eaa690f62226e093508992b33ed4
Reviewed-on: https://dart-review.googlesource.com/9961
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-03 07:56:13 +00:00
..
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00
2017-04-17 14:53:02 -07:00