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 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 } else { | 28 } else { |
29 t0 = 3; | 29 t0 = 3; |
30 } | 30 } |
31 print(t0); | 31 print(t0); |
32 } | 32 } |
33 print(t0); | 33 print(t0); |
34 } | 34 } |
35 """; | 35 """; |
36 | 36 |
37 const String NO_LOCAL = r""" | 37 const String NO_LOCAL = r""" |
38 foo(bar, bar) { | 38 foo(bar, baz) { |
39 if (bar) { | 39 if (bar) { |
40 baz = 2; | 40 baz = 2; |
41 } else { | 41 } else { |
42 baz = 3; | 42 baz = 3; |
43 } | 43 } |
44 return baz; | 44 return baz; |
45 } | 45 } |
46 """; | 46 """; |
47 | 47 |
48 const String MULTIPLE_PHIS_ONE_LOCAL = r""" | 48 const String MULTIPLE_PHIS_ONE_LOCAL = r""" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 compile(NO_LOCAL, entry: 'foo', check: (String generated) { | 97 compile(NO_LOCAL, entry: 'foo', check: (String generated) { |
98 Expect.isFalse(generated.contains('var')); | 98 Expect.isFalse(generated.contains('var')); |
99 }), | 99 }), |
100 | 100 |
101 compile(PARAMETER_INIT, entry: 'foo', check: (String generated) { | 101 compile(PARAMETER_INIT, entry: 'foo', check: (String generated) { |
102 // Check that there is only one var declaration. | 102 // Check that there is only one var declaration. |
103 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); | 103 checkNumberOfMatches(new RegExp("var").allMatches(generated).iterator, 1); |
104 }), | 104 }), |
105 ])); | 105 ])); |
106 } | 106 } |
OLD | NEW |