OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; |
| 7 |
| 8 class A { |
| 9 int a = -1; |
| 10 |
| 11 @NoInline() |
| 12 foo(ignored, val) { |
| 13 Expect.equals(val, this.a); |
| 14 } |
| 15 } |
| 16 |
| 17 testA() async { |
| 18 var a = new A(); |
| 19 a.foo(await false, -1); |
| 20 a.a = 0; |
| 21 a.foo(await false, 0); |
| 22 } |
| 23 |
| 24 @NoInline() |
| 25 @AssumeDynamic() |
| 26 confuse(x) => x; |
| 27 |
| 28 class B { |
| 29 var f; |
| 30 @NoInline() |
| 31 var b = 10; |
| 32 B(this.f); |
| 33 |
| 34 bar(x) => b; |
| 35 } |
| 36 |
| 37 foo(x) => 499; |
| 38 bar(x) => 42; |
| 39 |
| 40 change(x) { |
| 41 x.f = (x) => 99; |
| 42 } |
| 43 |
| 44 testB() async { |
| 45 var b = confuse(new B(foo)); |
| 46 Expect.equals(99, b.f(await change(b))); |
| 47 var b2 = confuse(new B(bar)); |
| 48 Expect.equals(10, b2.f(await (b2.f = b2.bar))); |
| 49 } |
| 50 |
| 51 test() async { |
| 52 await testA(); |
| 53 await testB(); |
| 54 } |
| 55 |
| 56 void main() { |
| 57 asyncStart(); |
| 58 test().then((_) => asyncEnd()); |
| 59 } |
OLD | NEW |