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 | |
7 class Foo { | |
8 m({a, b, c}) { | |
9 try {} catch(e) {} // no inline | |
10 return 'Foo $a $b $c'; | |
11 } | |
12 } | |
13 | |
14 class Bar { | |
15 m(z, {a$b, c}) { | |
16 try {} catch(e) {} // no inline | |
17 var ab = a$b; | |
18 return 'Bar $z $ab $c'; | |
19 } | |
20 } | |
21 | |
22 inscrutable(xs, i) => i == 0 ? xs[0] : inscrutable(xs.sublist(1), i-1); | |
23 | |
24 main() { | |
25 var list = [new Foo(), new Bar()]; | |
26 var foo = inscrutable(list, 0); | |
27 var bar = inscrutable(list, 1); | |
28 | |
29 Expect.equals(r'Foo a b c', foo.m(a: 'a', b: 'b', c: 'c')); | |
30 Expect.equals(r'Bar z a$b c', bar.m('z', a$b: r'a$b', c: 'c')); | |
31 | |
32 Expect.throws(() => foo.m('z', a$b: r'a$b', c: 'c'), | |
33 (e) => e is NoSuchMethodError); | |
34 Expect.throws(() => bar.m(a: 'a', b: 'b', c: 'c'), | |
35 (e) => e is NoSuchMethodError); | |
36 } | |
OLD | NEW |