| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Regression test for http://dartbug.com/19191 | 5 // Regression test for http://dartbug.com/19191 |
| 6 | 6 |
| 7 class A { | 7 class A { |
| 8 var method; | 8 var method; |
| 9 | 9 |
| 10 noSuchMethod(Invocation invocation) { | 10 noSuchMethod(Invocation invocation) { |
| 11 if (invocation.isGetter) { | 11 if (invocation.isGetter) { |
| 12 return method; | 12 return method; |
| 13 } else if (invocation.isSetter) { | 13 } else if (invocation.isSetter) { |
| 14 method = invocation.positionalArguments[0]; | 14 method = invocation.positionalArguments[0]; |
| 15 return null; | 15 return null; |
| 16 } else if (invocation.isMethod) { | 16 } else if (invocation.isMethod) { |
| 17 return Function.apply(method, invocation.positionalArguments, | 17 return Function.apply( |
| 18 invocation.namedArguments); | 18 method, invocation.positionalArguments, invocation.namedArguments); |
| 19 } else { | 19 } else { |
| 20 throw new NoSuchMethodError(this, invocation.memberName, | 20 throw new NoSuchMethodError(this, invocation.memberName, |
| 21 invocation.positionalArguments, invocation.namedArguments); | 21 invocation.positionalArguments, invocation.namedArguments); |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 init() { | 25 init() { |
| 26 closure_fails = (String str) { | 26 closure_fails = (String str) { |
| 27 return str.toUpperCase(); | 27 return str.toUpperCase(); |
| 28 }; | 28 }; |
| 29 } | 29 } |
| 30 | 30 |
| 31 run() { | 31 run() { |
| 32 print(closure_fails("Hello World")); | 32 print(closure_fails("Hello World")); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 void main() { | 36 void main() { |
| 37 var a = new A(); | 37 var a = new A(); |
| 38 a.init(); | 38 a.init(); |
| 39 a.run(); | 39 a.run(); |
| 40 } | 40 } |
| 41 | |
| OLD | NEW |