| 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 // Test that closures have a useful string that identifies the function by name | 5 // Test that closures have a useful string that identifies the function by name |
| 6 // in error messages. | 6 // in error messages. |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 @NoInline | 10 @NoInline() |
| 11 @AssumeDynamic | 11 @AssumeDynamic() |
| 12 confuse(x) => x; | 12 confuse(x) => x; |
| 13 | 13 |
| 14 class CCCC { | 14 class CCCC { |
| 15 instanceMethod([a, b]) => '[$a, $b]'; | 15 instanceMethod([a, b]) => '[$a, $b]'; |
| 16 static staticMethod() => 'hi'; | 16 static staticMethod() => 'hi'; |
| 17 // Default `toString` method returns "Instance of 'CCCC'" or similar with a | 17 // Default `toString` method returns "Instance of 'CCCC'" or similar with a |
| 18 // shorter name if minified. | 18 // shorter name if minified. |
| 19 } | 19 } |
| 20 | 20 |
| 21 main() { | 21 main() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 checkContains(s5, "main_closure"); | 74 checkContains(s5, "main_closure"); |
| 75 checkContains('$anon', "main_closure"); | 75 checkContains('$anon', "main_closure"); |
| 76 | 76 |
| 77 // Local named closure. | 77 // Local named closure. |
| 78 localFunction() => c; | 78 localFunction() => c; |
| 79 var e6 = new ArgumentError.value(localFunction); | 79 var e6 = new ArgumentError.value(localFunction); |
| 80 var s6 = '$e6'; | 80 var s6 = '$e6'; |
| 81 checkContains(s6, "localFunction"); | 81 checkContains(s6, "localFunction"); |
| 82 checkContains('$localFunction', "localFunction"); | 82 checkContains('$localFunction', "localFunction"); |
| 83 } | 83 } |
| OLD | NEW |