| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Test that constants depended on by other constants are correctly deferred. | 5 // Test that constants depended on by other constants are correctly deferred. |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:compiler/src/common.dart'; | 8 import 'package:compiler/src/common.dart'; |
| 9 import 'package:compiler/src/constants/values.dart'; | 9 import 'package:compiler/src/constants/values.dart'; |
| 10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 List<ConstantValue> allConstants = []; | 25 List<ConstantValue> allConstants = []; |
| 26 | 26 |
| 27 addConstantWithDependendencies(ConstantValue c) { | 27 addConstantWithDependendencies(ConstantValue c) { |
| 28 allConstants.add(c); | 28 allConstants.add(c); |
| 29 c.getDependencies().forEach(addConstantWithDependendencies); | 29 c.getDependencies().forEach(addConstantWithDependendencies); |
| 30 } | 30 } |
| 31 | 31 |
| 32 backend.constants.compiledConstants.forEach(addConstantWithDependendencies); | 32 backend.constants.compiledConstants.forEach(addConstantWithDependendencies); |
| 33 for (String stringValue in ["cA", "cB", "cC"]) { | 33 for (String stringValue in ["cA", "cB", "cC"]) { |
| 34 ConstantValue constant = allConstants.firstWhere((constant) { | 34 ConstantValue constant = allConstants.firstWhere((constant) { |
| 35 return constant.isString && | 35 return constant.isString && constant.primitiveValue == stringValue; |
| 36 constant.primitiveValue.slowToString() == stringValue; | |
| 37 }); | 36 }); |
| 38 Expect.notEquals(null, outputUnitForConstant(constant), | 37 Expect.notEquals(null, outputUnitForConstant(constant), |
| 39 "Constant value ${constant.toStructuredText()} has no output unit."); | 38 "Constant value ${constant.toStructuredText()} has no output unit."); |
| 40 Expect.notEquals( | 39 Expect.notEquals( |
| 41 mainOutputUnit, | 40 mainOutputUnit, |
| 42 outputUnitForConstant(constant), | 41 outputUnitForConstant(constant), |
| 43 "Constant value ${constant.toStructuredText()} " | 42 "Constant value ${constant.toStructuredText()} " |
| 44 "is in the main output unit."); | 43 "is in the main output unit."); |
| 45 } | 44 } |
| 46 }); | 45 }); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 66 """, | 65 """, |
| 67 "lib.dart": """ | 66 "lib.dart": """ |
| 68 class C { | 67 class C { |
| 69 final a; | 68 final a; |
| 70 const C(this.a); | 69 const C(this.a); |
| 71 } | 70 } |
| 72 | 71 |
| 73 const L = const {"cA": const C(const {"cB": "cC"})}; | 72 const L = const {"cA": const C(const {"cB": "cC"})}; |
| 74 """, | 73 """, |
| 75 }; | 74 }; |
| OLD | NEW |