Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1804)

Unified Diff: pkg/polymer/lib/src/build/import_inliner.dart

Issue 662013004: fix duplicate script issue (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add warnings and fix dynamic version Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/src/build/import_inliner.dart
diff --git a/pkg/polymer/lib/src/build/import_inliner.dart b/pkg/polymer/lib/src/build/import_inliner.dart
index cf3b7d931e3c6ad44e52c0f90bc95b0d30f83bb2..8b8887d3fe40c2d1f2fbdfacbff62f1cda9accf3 100644
--- a/pkg/polymer/lib/src/build/import_inliner.dart
+++ b/pkg/polymer/lib/src/build/import_inliner.dart
@@ -30,7 +30,7 @@ class _HtmlInliner extends PolymerTransformer {
final BuildLogger logger;
final AssetId docId;
final seen = new Set<AssetId>();
- final scriptIds = <AssetId>[];
+ final scriptIds = new List<AssetId>();
Siggi Cherem (dart-lang) 2014/10/21 17:06:03 undo?
jakemac 2014/10/21 18:14:01 Done.
final inlinedStylesheetIds = new Set<AssetId>();
final extractedFiles = new Set<AssetId>();
bool experimentalBootstrap = false;
@@ -241,6 +241,13 @@ class _HtmlInliner extends PolymerTransformer {
var src = script.attributes['src'];
var srcId = uriToAssetId(docId, src, logger, script.sourceSpan);
+ // No duplicates allowed!
+ if (scriptIds.contains(srcId)) {
Siggi Cherem (dart-lang) 2014/10/21 17:06:03 might be worth to keep a set on the side here - to
jakemac 2014/10/21 18:14:01 Done.
+ logger.warning(SCRIPT_INCLUDED_MORE_THAN_ONCE.create({'url': src}),
+ span: script.sourceSpan);
+ return true;
+ }
+
// We check for extractedFiles because 'hasInput' below is only true for
// assets that existed before this transformer runs (hasInput is false
// for files created by [_extractScripts]).

Powered by Google App Engine
This is Rietveld 408576698