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 library dart2js.constant_system.js; | 5 library dart2js.constant_system.js; |
6 | 6 |
7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
8 import '../constant_system_dart.dart'; | 8 import '../constant_system_dart.dart'; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 BoolConstantValue createBool(bool value) => new BoolConstantValue(value); | 258 BoolConstantValue createBool(bool value) => new BoolConstantValue(value); |
259 NullConstantValue createNull() => new NullConstantValue(); | 259 NullConstantValue createNull() => new NullConstantValue(); |
260 | 260 |
261 @override | 261 @override |
262 ListConstantValue createList(InterfaceType type, List<ConstantValue> values) { | 262 ListConstantValue createList(InterfaceType type, List<ConstantValue> values) { |
263 return new ListConstantValue(type, values); | 263 return new ListConstantValue(type, values); |
264 } | 264 } |
265 | 265 |
266 @override | 266 @override |
267 ConstantValue createType(Compiler compiler, DartType type) { | 267 ConstantValue createType(Compiler compiler, DartType type) { |
268 return new TypeConstantValue(type, | 268 return new TypeConstantValue( |
269 compiler.backend.typeImplementation.computeType(compiler.resolution)); | 269 type, |
| 270 compiler.backend.backendClasses.typeImplementation |
| 271 .computeType(compiler.resolution)); |
270 } | 272 } |
271 | 273 |
272 // Integer checks report true for -0.0, INFINITY, and -INFINITY. At | 274 // Integer checks report true for -0.0, INFINITY, and -INFINITY. At |
273 // runtime an 'X is int' check is implemented as: | 275 // runtime an 'X is int' check is implemented as: |
274 // | 276 // |
275 // typeof(X) === "number" && Math.floor(X) === X | 277 // typeof(X) === "number" && Math.floor(X) === X |
276 // | 278 // |
277 // We consistently match that runtime semantics at compile time as well. | 279 // We consistently match that runtime semantics at compile time as well. |
278 bool isInt(ConstantValue constant) { | 280 bool isInt(ConstantValue constant) { |
279 return constant.isInt || | 281 return constant.isInt || |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 result.add(keyList); | 400 result.add(keyList); |
399 } else { | 401 } else { |
400 // Add the keys individually to avoid generating an unused list constant | 402 // Add the keys individually to avoid generating an unused list constant |
401 // for the keys. | 403 // for the keys. |
402 result.addAll(keys); | 404 result.addAll(keys); |
403 } | 405 } |
404 result.addAll(values); | 406 result.addAll(values); |
405 return result; | 407 return result; |
406 } | 408 } |
407 } | 409 } |
OLD | NEW |