OLD | NEW |
(Empty) | |
| 1 import 'dart:html'; |
| 2 import 'package:js/js.dart'; |
| 3 import 'package:expect/expect.dart'; |
| 4 |
| 5 @JS() |
| 6 @anonymous |
| 7 class C { |
| 8 final foo; |
| 9 |
| 10 external factory C({foo}); |
| 11 } |
| 12 |
| 13 @JS() |
| 14 @anonymous |
| 15 class D { |
| 16 final foo; |
| 17 |
| 18 external factory D({foo}); |
| 19 } |
| 20 |
| 21 class F { |
| 22 final foo; |
| 23 |
| 24 F(this.foo); |
| 25 } |
| 26 |
| 27 @NoInline() |
| 28 testA(A o) { |
| 29 return o.foo; |
| 30 } |
| 31 |
| 32 @NoInline() |
| 33 testC(C o) { |
| 34 return o.foo; |
| 35 } |
| 36 |
| 37 @NoInline() |
| 38 testF(F o) { |
| 39 return o.foo; |
| 40 } |
| 41 |
| 42 void expectValueOrTypeError(f(), value) { |
| 43 try { |
| 44 String i = 0; // Test for checked mode. |
| 45 Expect.equals(f(), value); |
| 46 } on TypeError catch (error) { |
| 47 Expect.throws(f, (ex) => ex is TypeError); |
| 48 } |
| 49 } |
| 50 |
| 51 main() { |
| 52 var d = new D(foo: 4); |
| 53 var f = new F(6); |
| 54 Expect.equals(testC(d), 4); |
| 55 Expect.equals(testF(f), 6); /// 01: ok |
| 56 } |
| 57 |
| 58 |
OLD | NEW |