| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 class List { | 214 class List { |
| 215 List(); | 215 List(); |
| 216 List.fixedLength(length); | 216 List.fixedLength(length); |
| 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''' |
| 225 class JSArray { |
| 226 var length; |
| 227 var removeLast; |
| 228 operator[] (_) {} |
| 229 } |
| 230 class JSString { |
| 231 var length; |
| 232 } |
| 233 class JSNumber { |
| 234 } |
| 235 class JSInt { |
| 236 } |
| 237 class JSDouble { |
| 238 } |
| 239 class JSNull { |
| 240 } |
| 241 class JSBool { |
| 242 } |
| 243 class JSFunction { |
| 244 } |
| 245 class ObjectInterceptor { |
| 246 } |
| 247 getInterceptor(x) {}'''; |
| 248 |
| 224 expect(String code, int kind) { | 249 expect(String code, int kind) { |
| 225 String generated = | 250 String generated = compile( |
| 226 compile(code, coreSource: DEFAULT_CORELIB_WITH_LIST_INTERFACE); | 251 code, |
| 252 coreSource: DEFAULT_CORELIB_WITH_LIST_INTERFACE, |
| 253 interceptorsSource: INTERCEPTORSLIB_WITH_MEMBERS); |
| 227 switch (kind) { | 254 switch (kind) { |
| 228 case REMOVED: | 255 case REMOVED: |
| 229 Expect.isTrue(!generated.contains('ioore')); | 256 Expect.isTrue(!generated.contains('ioore')); |
| 230 break; | 257 break; |
| 231 | 258 |
| 232 case ABOVE_ZERO: | 259 case ABOVE_ZERO: |
| 233 Expect.isTrue(!generated.contains('< 0')); | 260 Expect.isTrue(!generated.contains('< 0')); |
| 234 Expect.isTrue(generated.contains('ioore')); | 261 Expect.isTrue(generated.contains('ioore')); |
| 235 Expect.isTrue(generated.contains('ioore')); | 262 Expect.isTrue(generated.contains('ioore')); |
| 236 break; | 263 break; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 257 break; | 284 break; |
| 258 } | 285 } |
| 259 } | 286 } |
| 260 | 287 |
| 261 | 288 |
| 262 main() { | 289 main() { |
| 263 for (int i = 0; i < TESTS.length; i += 2) { | 290 for (int i = 0; i < TESTS.length; i += 2) { |
| 264 expect(TESTS[i], TESTS[i + 1]); | 291 expect(TESTS[i], TESTS[i + 1]); |
| 265 } | 292 } |
| 266 } | 293 } |
| OLD | NEW |