| 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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
| 8 import 'parser_helper.dart'; | 8 import 'parser_helper.dart'; |
| 9 | 9 |
| 10 const String TEST_INVOCATION0 = r""" | 10 const String TEST_INVOCATION0 = r""" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Expect.isTrue(generated.contains(r".call$0()")); | 45 Expect.isTrue(generated.contains(r".call$0()")); |
| 46 generated = compile(TEST_INVOCATION1); | 46 generated = compile(TEST_INVOCATION1); |
| 47 Expect.isTrue(generated.contains(r".call$1(1)")); | 47 Expect.isTrue(generated.contains(r".call$1(1)")); |
| 48 generated = compile(TEST_INVOCATION2); | 48 generated = compile(TEST_INVOCATION2); |
| 49 Expect.isTrue(generated.contains(r".call$2(1, 2)")); | 49 Expect.isTrue(generated.contains(r".call$2(1, 2)")); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Make sure that the bailout version does not introduce a second version of | 52 // Make sure that the bailout version does not introduce a second version of |
| 53 // the closure. | 53 // the closure. |
| 54 closureBailout() { | 54 closureBailout() { |
| 55 String generated = compileAll(TEST_BAILOUT); | 55 compileAll(TEST_BAILOUT).then((generated) { |
| 56 RegExp regexp = new RegExp(r'call\$0: function'); | 56 RegExp regexp = new RegExp(r'call\$0: function'); |
| 57 Iterator<Match> matches = regexp.allMatches(generated).iterator; | 57 Iterator<Match> matches = regexp.allMatches(generated).iterator; |
| 58 checkNumberOfMatches(matches, 1); | 58 checkNumberOfMatches(matches, 1); |
| 59 }); |
| 59 } | 60 } |
| 60 | 61 |
| 61 main() { | 62 main() { |
| 62 closureInvocation(); | 63 closureInvocation(); |
| 63 closureBailout(); | 64 closureBailout(); |
| 64 } | 65 } |
| OLD | NEW |