Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 import 'dart:async'; | |
| 2 | |
| 3 import 'package:expect/expect.dart'; | |
| 4 | |
| 5 class Foo { | |
| 6 Future _x; | |
| 7 int z; | |
| 8 List list = []; | |
| 9 | |
| 10 Future foo() async { | |
| 11 _x ??= new Future(() async { | |
|
Jennifer Messerly
2017/04/04 23:34:24
is it worth adding a comment about what's going on
vsm
2017/04/05 19:14:31
Thanks - added comment pointing to #issue number f
| |
| 12 z = await new Future.value(42); | |
| 13 list = list.toList()..add(z); | |
|
Jennifer Messerly
2017/04/04 23:34:24
// this triggers a nested MetaLet which breaks the
vsm
2017/04/05 19:14:31
Ditto
| |
| 14 }); | |
| 15 await _x; | |
| 16 return list[0]; | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 main() async { | |
| 21 var f = new Foo(); | |
| 22 var result = await f.foo(); | |
| 23 Expect.equals(42, result); | |
| 24 } | |
| OLD | NEW |