| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 | 6 |
| 7 class Foo { | 7 class Foo { |
| 8 m({a, b, c}) { | 8 m({a, b, c}) { |
| 9 try {} catch(e) {} // no inline | 9 try {} catch (e) {} // no inline |
| 10 return 'Foo $a $b $c'; | 10 return 'Foo $a $b $c'; |
| 11 } | 11 } |
| 12 } | 12 } |
| 13 | 13 |
| 14 class Bar { | 14 class Bar { |
| 15 m(z, {a$b, c}) { | 15 m(z, {a$b, c}) { |
| 16 try {} catch(e) {} // no inline | 16 try {} catch (e) {} // no inline |
| 17 var ab = a$b; | 17 var ab = a$b; |
| 18 return 'Bar $z $ab $c'; | 18 return 'Bar $z $ab $c'; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 inscrutable(xs, i) => i == 0 ? xs[0] : inscrutable(xs.sublist(1), i-1); | 22 inscrutable(xs, i) => i == 0 ? xs[0] : inscrutable(xs.sublist(1), i - 1); |
| 23 | 23 |
| 24 main() { | 24 main() { |
| 25 var list = [new Foo(), new Bar()]; | 25 var list = [new Foo(), new Bar()]; |
| 26 var foo = inscrutable(list, 0); | 26 var foo = inscrutable(list, 0); |
| 27 var bar = inscrutable(list, 1); | 27 var bar = inscrutable(list, 1); |
| 28 | 28 |
| 29 Expect.equals(r'Foo a b c', foo.m(a: 'a', b: 'b', c: 'c')); | 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')); | 30 Expect.equals(r'Bar z a$b c', bar.m('z', a$b: r'a$b', c: 'c')); |
| 31 | 31 |
| 32 Expect.throws(() => foo.m('z', a$b: r'a$b', c: 'c'), | 32 Expect.throws( |
| 33 (e) => e is NoSuchMethodError); | 33 () => foo.m('z', a$b: r'a$b', c: 'c'), (e) => e is NoSuchMethodError); |
| 34 Expect.throws(() => bar.m(a: 'a', b: 'b', c: 'c'), | 34 Expect.throws( |
| 35 (e) => e is NoSuchMethodError); | 35 () => bar.m(a: 'a', b: 'b', c: 'c'), (e) => e is NoSuchMethodError); |
| 36 } | 36 } |
| OLD | NEW |