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 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
7 | 7 |
8 const String TEST_ONE = r""" | 8 const String TEST_ONE = r""" |
9 void foo(bar) { | 9 void foo(bar) { |
10 var a = 1; | 10 var a = 1; |
11 if (bar) { | 11 if (bar) { |
12 a = 2; | 12 a = 2; |
13 } else { | 13 } else { |
14 a = 3; | 14 a = 3; |
15 } | 15 } |
16 print(a); | 16 print(a); |
| 17 print(a); |
17 } | 18 } |
18 """; | 19 """; |
19 | 20 |
20 const String TEST_TWO = r""" | 21 const String TEST_TWO = r""" |
21 void main() { | 22 void main() { |
22 var t = 0; | 23 var t = 0; |
23 for (var i = 0; i == 0; i = i + 1) { | 24 for (var i = 0; i == 0; i = i + 1) { |
24 t = t + 10; | 25 t = t + 10; |
25 } | 26 } |
26 print(t); | 27 print(t); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); | 78 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); |
78 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); | 79 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); |
79 // Check that a store just after the declaration of the local | 80 // Check that a store just after the declaration of the local |
80 // only generates one instruction. | 81 // only generates one instruction. |
81 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); | 82 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); |
82 | 83 |
83 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); | 84 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); |
84 | 85 |
85 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')); | 86 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')); |
86 } | 87 } |
OLD | NEW |