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: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 'memory_source_file_helper.dart'; | 9 import 'memory_source_file_helper.dart'; |
10 import "dart:async"; | 10 import "dart:async"; |
(...skipping 19 matching lines...) Expand all Loading... |
30 (name, extension) => new FakeOutputStream(), | 30 (name, extension) => new FakeOutputStream(), |
31 handler.diagnosticHandler, | 31 handler.diagnosticHandler, |
32 libraryRoot, | 32 libraryRoot, |
33 packageRoot, | 33 packageRoot, |
34 [], | 34 [], |
35 {}); | 35 {}); |
36 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { | 36 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
37 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; | 37 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; |
38 var outputUnitForConstant = compiler.deferredLoadTask.outputUnitForConstant; | 38 var outputUnitForConstant = compiler.deferredLoadTask.outputUnitForConstant; |
39 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; | 39 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; |
40 var lib = compiler.libraries["memory:lib.dart"]; | 40 var lib = |
| 41 compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart")); |
41 var backend = compiler.backend; | 42 var backend = compiler.backend; |
42 List<Constant> allConstants = []; | 43 List<Constant> allConstants = []; |
43 | 44 |
44 addConstantWithDependendencies(Constant c) { | 45 addConstantWithDependendencies(Constant c) { |
45 allConstants.add(c); | 46 allConstants.add(c); |
46 c.getDependencies().forEach(addConstantWithDependendencies); | 47 c.getDependencies().forEach(addConstantWithDependendencies); |
47 } | 48 } |
48 | 49 |
49 backend.constants.compiledConstants.forEach(addConstantWithDependendencies); | 50 backend.constants.compiledConstants.forEach(addConstantWithDependendencies); |
50 for (String stringValue in ["cA", "cB", "cC"]) { | 51 for (String stringValue in ["cA", "cB", "cC"]) { |
(...skipping 24 matching lines...) Expand all Loading... |
75 print(lib.L); | 76 print(lib.L); |
76 } | 77 } |
77 """, "lib.dart": """ | 78 """, "lib.dart": """ |
78 class C { | 79 class C { |
79 final a; | 80 final a; |
80 const C(this.a); | 81 const C(this.a); |
81 } | 82 } |
82 | 83 |
83 const L = const {"cA": const C(const {"cB": "cC"})}; | 84 const L = const {"cA": const C(const {"cB": "cC"})}; |
84 """,}; | 85 """,}; |
OLD | NEW |