Skip to content

Commit bcec623

Browse files
author
John Messerly
committed
fixes #315, order of libraries in the HTML file
the lesson here is never use .importedLibraries ... we might want to change it in analyzer to use LinkedHashSet ... R=vsm@google.com Review URL: https://codereview.chromium.org/1337993004 .
1 parent ff1b78c commit bcec623

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/dev_compiler/lib/src/compiler.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ class BatchCompiler extends AbstractCompiler {
152152
// TODO(jmesserly): in incremental mode, we can skip the transitive
153153
// compile of imports/exports.
154154
_compileLibrary(_dartCore); // implicit dart:core dependency
155-
library.importedLibraries.forEach(_compileLibrary);
156-
library.exportedLibraries.forEach(_compileLibrary);
155+
for (var import in library.imports) _compileLibrary(import.importedLibrary);
156+
for (var export in library.exports) _compileLibrary(export.exportedLibrary);
157157

158158
var unitElements = [library.definingCompilationUnit]..addAll(library.parts);
159159
var units = <CompilationUnit>[];
@@ -269,8 +269,9 @@ class BatchCompiler extends AbstractCompiler {
269269
var uri = lib.source.uri;
270270
if (!loaded.add(uri)) return;
271271
_collectLibraries(_dartCore, loaded);
272-
for (var l in lib.importedLibraries) _collectLibraries(l, loaded);
273-
for (var l in lib.exportedLibraries) _collectLibraries(l, loaded);
272+
273+
for (var l in lib.imports) _collectLibraries(l.importedLibrary, loaded);
274+
for (var l in lib.exports) _collectLibraries(l.exportedLibrary, loaded);
274275
// Move the item to the end of the list.
275276
loaded.remove(uri);
276277
loaded.add(uri);

pkg/dev_compiler/test/codegen/expect/sunflower/sunflower.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ <h1>drfibonacci's Sunflower Spectacular</h1>
5151
<script src="../dev_compiler/runtime/dart/mirrors.js"></script>
5252
<script src="../dev_compiler/runtime/dart/_js_mirrors.js"></script>
5353
<script src="../dev_compiler/runtime/dart/js.js"></script>
54-
<script src="dom.js"></script>
5554
<script src="circle.js"></script>
55+
<script src="dom.js"></script>
5656
<script src="painter.js"></script>
5757
<script src="sunflower.js"></script>
5858
<script>dart_library.start('sunflower/sunflower');</script>

0 commit comments

Comments
 (0)