| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "dart:mirrors" show reflect; |
| 5 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 6 | 7 |
| 7 // Checks that noSuchMethod is resolved in the super class and not in the | 8 // Checks that noSuchMethod is resolved in the super class and not in the |
| 8 // current class. | 9 // current class. |
| 9 | 10 |
| 10 class C { | 11 class C { |
| 11 E e = new E(); | 12 E e = new E(); |
| 12 | 13 |
| 13 bool noSuchMethod(Invocation im) { | 14 bool noSuchMethod(Invocation im) { |
| 14 if (im.memberName == const Symbol('foo')) { | 15 if (im.memberName == const Symbol('foo')) { |
| 15 return im.positionalArguments.isEmpty && | 16 return im.positionalArguments.isEmpty && |
| 16 im.namedArguments.isEmpty && | 17 im.namedArguments.isEmpty && |
| 17 im.invokeOn(e); | 18 reflect(e).delegate(im); |
| 18 } | 19 } |
| 19 if (im.memberName == const Symbol('bar')) { | 20 if (im.memberName == const Symbol('bar')) { |
| 20 return im.positionalArguments.length == 1 && | 21 return im.positionalArguments.length == 1 && |
| 21 im.namedArguments.isEmpty && | 22 im.namedArguments.isEmpty && |
| 22 im.invokeOn(e); | 23 reflect(e).delegate(im); |
| 23 } | 24 } |
| 24 if (im.memberName == const Symbol('baz')) { | 25 if (im.memberName == const Symbol('baz')) { |
| 25 return im.positionalArguments.isEmpty && | 26 return im.positionalArguments.isEmpty && |
| 26 im.namedArguments.length == 1 && | 27 im.namedArguments.length == 1 && |
| 27 im.invokeOn(e); | 28 reflect(e).delegate(im); |
| 28 } | 29 } |
| 29 if (im.memberName == const Symbol('boz')) { | 30 if (im.memberName == const Symbol('boz')) { |
| 30 return im.positionalArguments.length == 1 && | 31 return im.positionalArguments.length == 1 && |
| 31 im.namedArguments.length == 1 && | 32 im.namedArguments.length == 1 && |
| 32 im.invokeOn(e); | 33 reflect(e).delegate(im); |
| 33 } | 34 } |
| 34 return false; | 35 return false; |
| 35 } | 36 } |
| 36 } | 37 } |
| 37 | 38 |
| 38 class D extends C { | 39 class D extends C { |
| 39 bool noSuchMethod(Invocation im) { | 40 bool noSuchMethod(Invocation im) { |
| 40 return false; | 41 return false; |
| 41 } | 42 } |
| 42 test1() { | 43 test1() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 bool boz(int a, {int c}) => a == 1 && c == 2; | 61 bool boz(int a, {int c}) => a == 1 && c == 2; |
| 61 } | 62 } |
| 62 | 63 |
| 63 main() { | 64 main() { |
| 64 var d = new D(); | 65 var d = new D(); |
| 65 Expect.isTrue(d.test1()); | 66 Expect.isTrue(d.test1()); |
| 66 Expect.isTrue(d.test2()); | 67 Expect.isTrue(d.test2()); |
| 67 Expect.isTrue(d.test3()); | 68 Expect.isTrue(d.test3()); |
| 68 Expect.isTrue(d.test4()); | 69 Expect.isTrue(d.test4()); |
| 69 } | 70 } |
| OLD | NEW |