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

Side by Side Diff: pkg/polymer/lib/src/build/script_compactor.dart

Issue 223553008: Only pass an AssetId to isPrimary and declareOutputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix script_compactor Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/src/build/polyfill_injector.dart ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// Transfomer that combines multiple dart script tags into a single one. 5 /// Transfomer that combines multiple dart script tags into a single one.
6 library polymer.src.build.script_compactor; 6 library polymer.src.build.script_compactor;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:convert'; 9 import 'dart:convert';
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 /// statement to a library, and then uses `initPolymer` (see polymer.dart) to 42 /// statement to a library, and then uses `initPolymer` (see polymer.dart) to
43 /// process `@initMethod` and `@CustomTag` annotations in those libraries. 43 /// process `@initMethod` and `@CustomTag` annotations in those libraries.
44 class ScriptCompactor extends Transformer { 44 class ScriptCompactor extends Transformer {
45 final Resolvers resolvers; 45 final Resolvers resolvers;
46 final TransformOptions options; 46 final TransformOptions options;
47 47
48 ScriptCompactor(this.options, {String sdkDir}) 48 ScriptCompactor(this.options, {String sdkDir})
49 : resolvers = new Resolvers(sdkDir != null ? sdkDir : dartSdkDirectory); 49 : resolvers = new Resolvers(sdkDir != null ? sdkDir : dartSdkDirectory);
50 50
51 /// Only run on entry point .html files. 51 /// Only run on entry point .html files.
52 Future<bool> isPrimary(Asset input) => 52 // TODO(nweiz): This should just take an AssetId when barback <0.13.0 support
53 new Future.value(options.isHtmlEntryPoint(input.id)); 53 // is dropped.
54 Future<bool> isPrimary(idOrAsset) {
55 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id;
56 return new Future.value(options.isHtmlEntryPoint(id));
57 }
54 58
55 Future apply(Transform transform) => 59 Future apply(Transform transform) =>
56 new _ScriptCompactor(transform, options, resolvers).apply(); 60 new _ScriptCompactor(transform, options, resolvers).apply();
57 } 61 }
58 62
59 /// Helper class mainly use to flatten the async code. 63 /// Helper class mainly use to flatten the async code.
60 class _ScriptCompactor extends PolymerTransformer { 64 class _ScriptCompactor extends PolymerTransformer {
61 final TransformOptions options; 65 final TransformOptions options;
62 final Transform transform; 66 final Transform transform;
63 final TransformLogger logger; 67 final TransformLogger logger;
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 for (var c in combinators) { 688 for (var c in combinators) {
685 if (c is ShowElementCombinator) { 689 if (c is ShowElementCombinator) {
686 var show = c.shownNames.toSet(); 690 var show = c.shownNames.toSet();
687 elements.retainWhere((e) => show.contains(e.displayName)); 691 elements.retainWhere((e) => show.contains(e.displayName));
688 } else if (c is HideElementCombinator) { 692 } else if (c is HideElementCombinator) {
689 var hide = c.hiddenNames.toSet(); 693 var hide = c.hiddenNames.toSet();
690 elements.removeWhere((e) => hide.contains(e.displayName)); 694 elements.removeWhere((e) => hide.contains(e.displayName));
691 } 695 }
692 } 696 }
693 } 697 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/polyfill_injector.dart ('k') | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698