| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
| 7 | 7 |
| 8 const String FOO = r""" | 8 const String FOO = r""" |
| 9 void foo(var a, var b) { | 9 void foo(var a, var b) { |
| 10 } | 10 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 print(result); | 66 print(result); |
| 67 } | 67 } |
| 68 """; | 68 """; |
| 69 | 69 |
| 70 main() { | 70 main() { |
| 71 String generated = compile(FOO, entry: 'foo'); | 71 String generated = compile(FOO, entry: 'foo'); |
| 72 Expect.isTrue(generated.contains(r"function(a, b) {")); | 72 Expect.isTrue(generated.contains(r"function(a, b) {")); |
| 73 | 73 |
| 74 generated = compile(BAR, entry: 'bar'); | 74 generated = compile(BAR, entry: 'bar'); |
| 75 Expect.isTrue(generated.contains(r"function(eval$, $$eval) {")); | 75 Expect.isTrue(generated.contains(r"function(eval, $$eval) {")); |
| 76 | 76 |
| 77 generated = compile(PARAMETER_AND_TEMP, entry: 'bar'); | 77 generated = compile(PARAMETER_AND_TEMP, entry: 'bar'); |
| 78 Expect.isTrue(generated.contains(r"print(t00)")); | 78 Expect.isTrue(generated.contains(r"print(t00)")); |
| 79 // Check that the second 't0' got another name. | 79 // Check that the second 't0' got another name. |
| 80 Expect.isTrue(generated.contains(r"print(t01)")); | 80 Expect.isTrue(generated.contains(r"print(t01)")); |
| 81 | 81 |
| 82 generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo'); | 82 generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo'); |
| 83 Expect.isTrue(generated.contains("var a;")); | 83 Expect.isTrue(generated.contains("var a;")); |
| 84 // Check that there is only one var declaration. | 84 // Check that there is only one var declaration. |
| 85 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); | 85 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); |
| 86 | 86 |
| 87 generated = compile(NO_LOCAL, entry: 'foo'); | 87 generated = compile(NO_LOCAL, entry: 'foo'); |
| 88 Expect.isFalse(generated.contains('var')); | 88 Expect.isFalse(generated.contains('var')); |
| 89 | 89 |
| 90 generated = compile(PARAMETER_INIT, entry: 'foo'); | 90 generated = compile(PARAMETER_INIT, entry: 'foo'); |
| 91 Expect.isTrue(generated.contains('var result = test === true ? 42 : start')); | 91 Expect.isTrue(generated.contains('var result = test === true ? 42 : start')); |
| 92 // Check that there is only one var declaration. | 92 // Check that there is only one var declaration. |
| 93 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); | 93 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); |
| 94 } | 94 } |
| OLD | NEW |