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

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: fixes 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
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 30 matching lines...) Expand all
41 /// statement to a library, and then uses `initPolymer` (see polymer.dart) to 41 /// statement to a library, and then uses `initPolymer` (see polymer.dart) to
42 /// process `@initMethod` and `@CustomTag` annotations in those libraries. 42 /// process `@initMethod` and `@CustomTag` annotations in those libraries.
43 class ScriptCompactor extends Transformer { 43 class ScriptCompactor extends Transformer {
44 final Resolvers resolvers; 44 final Resolvers resolvers;
45 final TransformOptions options; 45 final TransformOptions options;
46 46
47 ScriptCompactor(this.options, {String sdkDir}) 47 ScriptCompactor(this.options, {String sdkDir})
48 : resolvers = new Resolvers(sdkDir != null ? sdkDir : dartSdkDirectory); 48 : resolvers = new Resolvers(sdkDir != null ? sdkDir : dartSdkDirectory);
49 49
50 /// Only run on entry point .html files. 50 /// Only run on entry point .html files.
51 Future<bool> isPrimary(Asset input) => 51 Future<bool> isPrimary(AssetId id) =>
52 new Future.value(options.isHtmlEntryPoint(input.id)); 52 new Future.value(options.isHtmlEntryPoint(id));
53 53
54 Future apply(Transform transform) => 54 Future apply(Transform transform) =>
55 new _ScriptCompactor(transform, options, resolvers).apply(); 55 new _ScriptCompactor(transform, options, resolvers).apply();
56 } 56 }
57 57
58 /// Helper class mainly use to flatten the async code. 58 /// Helper class mainly use to flatten the async code.
59 class _ScriptCompactor extends PolymerTransformer { 59 class _ScriptCompactor extends PolymerTransformer {
60 final TransformOptions options; 60 final TransformOptions options;
61 final Transform transform; 61 final Transform transform;
62 final TransformLogger logger; 62 final TransformLogger logger;
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 for (var c in combinators) { 695 for (var c in combinators) {
696 if (c is ShowElementCombinator) { 696 if (c is ShowElementCombinator) {
697 var show = c.shownNames.toSet(); 697 var show = c.shownNames.toSet();
698 elements.retainWhere((e) => show.contains(e.displayName)); 698 elements.retainWhere((e) => show.contains(e.displayName));
699 } else if (c is HideElementCombinator) { 699 } else if (c is HideElementCombinator) {
700 var hide = c.hiddenNames.toSet(); 700 var hide = c.hiddenNames.toSet();
701 elements.removeWhere((e) => hide.contains(e.displayName)); 701 elements.removeWhere((e) => hide.contains(e.displayName));
702 } 702 }
703 } 703 }
704 } 704 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698