OLD | NEW |
---|---|
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 Loading... | |
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 Future<bool> isPrimary(AssetId id) => |
Siggi Cherem (dart-lang)
2014/04/08 22:56:20
we seem to be missing the fix here
nweiz
2014/04/08 22:58:09
Oops, done.
| |
53 new Future.value(options.isHtmlEntryPoint(input.id)); | 53 new Future.value(options.isHtmlEntryPoint(id)); |
54 | 54 |
55 Future apply(Transform transform) => | 55 Future apply(Transform transform) => |
56 new _ScriptCompactor(transform, options, resolvers).apply(); | 56 new _ScriptCompactor(transform, options, resolvers).apply(); |
57 } | 57 } |
58 | 58 |
59 /// Helper class mainly use to flatten the async code. | 59 /// Helper class mainly use to flatten the async code. |
60 class _ScriptCompactor extends PolymerTransformer { | 60 class _ScriptCompactor extends PolymerTransformer { |
61 final TransformOptions options; | 61 final TransformOptions options; |
62 final Transform transform; | 62 final Transform transform; |
63 final TransformLogger logger; | 63 final TransformLogger logger; |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 for (var c in combinators) { | 684 for (var c in combinators) { |
685 if (c is ShowElementCombinator) { | 685 if (c is ShowElementCombinator) { |
686 var show = c.shownNames.toSet(); | 686 var show = c.shownNames.toSet(); |
687 elements.retainWhere((e) => show.contains(e.displayName)); | 687 elements.retainWhere((e) => show.contains(e.displayName)); |
688 } else if (c is HideElementCombinator) { | 688 } else if (c is HideElementCombinator) { |
689 var hide = c.hiddenNames.toSet(); | 689 var hide = c.hiddenNames.toSet(); |
690 elements.removeWhere((e) => hide.contains(e.displayName)); | 690 elements.removeWhere((e) => hide.contains(e.displayName)); |
691 } | 691 } |
692 } | 692 } |
693 } | 693 } |
OLD | NEW |