Chromium Code Reviews| Index: pkg/polymer/lib/src/mirror_loader.dart |
| diff --git a/pkg/polymer/lib/src/mirror_loader.dart b/pkg/polymer/lib/src/mirror_loader.dart |
| index c0cea5c46aa11a15844976eb30e895880f332fe0..257d4e2e6902629f22a13dff4d8de7e05621c102 100644 |
| --- a/pkg/polymer/lib/src/mirror_loader.dart |
| +++ b/pkg/polymer/lib/src/mirror_loader.dart |
| @@ -65,7 +65,8 @@ List<Function> discoverInitializers(Iterable<String> librariesToLoad) { |
| /// called after all HTML imports are resolved. Polymer ensures this by asking |
| /// users to put their Dart script tags after all HTML imports (this is checked |
| /// by the linter, and Dartium will otherwise show an error message). |
| -List<_ScriptInfo> _discoverScripts(Document doc, String baseUri, [_State state]) { |
| +List<_ScriptInfo> _discoverScripts( |
| + Document doc, String baseUri, [_State state]) { |
| if (state == null) state = new _State(); |
| if (doc == null) { |
| print('warning: $baseUri not found.'); |
| @@ -77,7 +78,13 @@ List<_ScriptInfo> _discoverScripts(Document doc, String baseUri, [_State state]) |
| if (node is LinkElement) { |
| _discoverScripts(node.import, node.href, state); |
| } else if (node is ScriptElement && node.type == 'application/dart') { |
| - state.scripts.add(_scriptInfoFor(node, baseUri)); |
| + var info = _scriptInfoFor(node, baseUri); |
| + // Bail and warn if this script has already been seen. |
| + if (state.scripts.any((s) => s.resolvedUrl == info.resolvedUrl)) { |
|
Siggi Cherem (dart-lang)
2014/10/21 17:06:03
similarly here, let's avoid the linear lookup. One
jakemac
2014/10/21 18:14:01
Done.
|
| + print('warning: script `${info.resolvedUrl}` included more than once.'); |
|
Siggi Cherem (dart-lang)
2014/10/21 17:06:03
consider including the short link to the details h
jakemac
2014/10/21 18:14:01
Done.
|
| + continue; |
| + }; |
| + state.scripts.add(info); |
| } |
| } |
| return state.scripts; |