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 | 4 |
5 import 'compiler_helper.dart'; | 5 import 'compiler_helper.dart'; |
6 | 6 |
7 const int REMOVED = 0; | 7 const int REMOVED = 0; |
8 const int ABOVE_ZERO = 1; | 8 const int ABOVE_ZERO = 1; |
9 const int BELOW_LENGTH = 2; | 9 const int BELOW_LENGTH = 2; |
10 const int KEPT = 3; | 10 const int KEPT = 3; |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 return sum; | 34 return sum; |
35 } | 35 } |
36 """, | 36 """, |
37 ABOVE_ZERO, | 37 ABOVE_ZERO, |
38 | 38 |
39 """ | 39 """ |
40 main(check) { | 40 main(check) { |
41 // Make sure value is an int. | 41 // Make sure value is an int. |
42 var value = check ? 42 : 54; | 42 var value = check ? 42 : 54; |
43 var a = new List.fixedLength(value); | 43 var a = new List(value); |
44 var sum = 0; | 44 var sum = 0; |
45 for (int i = 0; i < value; i++) { | 45 for (int i = 0; i < value; i++) { |
46 sum += a[i]; | 46 sum += a[i]; |
47 } | 47 } |
48 return sum; | 48 return sum; |
49 } | 49 } |
50 """, | 50 """, |
51 REMOVED, | 51 REMOVED, |
52 | 52 |
53 """ | 53 """ |
54 main() { | 54 main() { |
55 var a = new List(); | 55 var a = new List(); |
56 return a[0]; | 56 return a[0]; |
57 } | 57 } |
58 """, | 58 """, |
59 KEPT, | 59 KEPT, |
60 | 60 |
61 """ | 61 """ |
62 main() { | 62 main() { |
63 var a = new List(); | 63 var a = new List(); |
64 return a.removeLast(); | 64 return a.removeLast(); |
65 } | 65 } |
66 """, | 66 """, |
67 KEPT, | 67 KEPT, |
68 | 68 |
69 """ | 69 """ |
70 main() { | 70 main() { |
71 var a = new List.fixedLength(4); | 71 var a = new List(4); |
72 return a[0]; | 72 return a[0]; |
73 } | 73 } |
74 """, | 74 """, |
75 REMOVED, | 75 REMOVED, |
76 | 76 |
77 """ | 77 """ |
78 main() { | 78 main() { |
79 var a = new List.fixedLength(4); | 79 var a = new List(4); |
80 return a.removeLast(); | 80 return a.removeLast(); |
81 } | 81 } |
82 """, | 82 """, |
83 REMOVED, | 83 REMOVED, |
84 | 84 |
85 """ | 85 """ |
86 main(value) { | 86 main(value) { |
87 var a = new List.fixedLength(value); | 87 var a = new List(value); |
88 return a[value]; | 88 return a[value]; |
89 } | 89 } |
90 """, | 90 """, |
91 KEPT, | 91 KEPT, |
92 | 92 |
93 """ | 93 """ |
94 main(value) { | 94 main(value) { |
95 var a = new List.fixedLength(1024); | 95 var a = new List(1024); |
96 return a[1023 & value]; | 96 return a[1023 & value]; |
97 } | 97 } |
98 """, | 98 """, |
99 REMOVED, | 99 REMOVED, |
100 | 100 |
101 """ | 101 """ |
102 main(value) { | 102 main(value) { |
103 var a = new List.fixedLength(1024); | 103 var a = new List(1024); |
104 return a[1024 & value]; | 104 return a[1024 & value]; |
105 } | 105 } |
106 """, | 106 """, |
107 ABOVE_ZERO, | 107 ABOVE_ZERO, |
108 | 108 |
109 """ | 109 """ |
110 main(value) { | 110 main(value) { |
111 var a = new List(); | 111 var a = new List(); |
112 return a[1]; | 112 return a[1]; |
113 } | 113 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 print(var obj) {} | 205 print(var obj) {} |
206 abstract class num {} | 206 abstract class num {} |
207 abstract class int extends num { } | 207 abstract class int extends num { } |
208 abstract class double extends num { } | 208 abstract class double extends num { } |
209 class bool {} | 209 class bool {} |
210 class String {} | 210 class String {} |
211 class Object {} | 211 class Object {} |
212 class Type {} | 212 class Type {} |
213 class Function {} | 213 class Function {} |
214 class List { | 214 class List { |
215 List(); | 215 List([int length]); |
216 List.fixedLength(length); | 216 List.filled(int length, fill); |
217 } | 217 } |
218 abstract class Map {} | 218 abstract class Map {} |
219 class Closure {} | 219 class Closure {} |
220 class Null {} | 220 class Null {} |
221 class Dynamic_ {} | 221 class Dynamic_ {} |
222 bool identical(Object a, Object b) {}'''; | 222 bool identical(Object a, Object b) {}'''; |
223 | 223 |
224 const String INTERCEPTORSLIB_WITH_MEMBERS = r''' | 224 const String INTERCEPTORSLIB_WITH_MEMBERS = r''' |
225 class JSArray { | 225 class JSArray { |
226 var length; | 226 var length; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 break; | 299 break; |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 | 303 |
304 main() { | 304 main() { |
305 for (int i = 0; i < TESTS.length; i += 2) { | 305 for (int i = 0; i < TESTS.length; i += 2) { |
306 expect(TESTS[i], TESTS[i + 1]); | 306 expect(TESTS[i], TESTS[i + 1]); |
307 } | 307 } |
308 } | 308 } |
OLD | NEW |