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

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

Issue 293023008: Bring back initPolymer, allow boot.js only if using "polymer_experimental.html". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/linter.dart ('k') | pkg/polymer/lib/src/build/script_compactor.dart » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Transformer that removes uses of mirrors from the polymer runtime, so that 5 /// Transformer that removes uses of mirrors from the polymer runtime, so that
6 /// deployed applications are thin and small. 6 /// deployed applications are thin and small.
7 library polymer.src.build.mirrors_remover; 7 library polymer.src.build.mirrors_remover;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
(...skipping 14 matching lines...) Expand all
25 Future apply(Transform transform) { 25 Future apply(Transform transform) {
26 var id = transform.primaryInput.id; 26 var id = transform.primaryInput.id;
27 return transform.primaryInput.readAsString().then((code) { 27 return transform.primaryInput.readAsString().then((code) {
28 // Note: this rewrite is highly-coupled with how polymer.dart is 28 // Note: this rewrite is highly-coupled with how polymer.dart is
29 // written. Make sure both are updated in sync. 29 // written. Make sure both are updated in sync.
30 var start = code.indexOf('@MirrorsUsed('); 30 var start = code.indexOf('@MirrorsUsed(');
31 if (start == -1) _error(); 31 if (start == -1) _error();
32 var end = code.indexOf('show MirrorsUsed;', start); 32 var end = code.indexOf('show MirrorsUsed;', start);
33 if (end == -1) _error(); 33 if (end == -1) _error();
34 end = code.indexOf('\n', end); 34 end = code.indexOf('\n', end);
35 var loaderImport = code.indexOf(
36 "import 'src/mirror_loader.dart' as loader;", end);
37 if (loaderImport == -1) _error();
35 var sb = new StringBuffer() 38 var sb = new StringBuffer()
36 ..write(code.substring(0, start)) 39 ..write(code.substring(0, start))
37 ..write(code.substring(end)); 40 ..write(code.substring(end)
41 .replaceAll('src/mirror_loader.dart', 'src/static_loader.dart'));
38 42
39 transform.addOutput(new Asset.fromString(id, sb.toString())); 43 transform.addOutput(new Asset.fromString(id, sb.toString()));
40 }); 44 });
41 } 45 }
42 } 46 }
43 47
44 /** Transformer phases which should be applied to the smoke package. */ 48 /** Transformer phases which should be applied to the smoke package. */
45 List<List<Transformer>> get phasesForSmoke => 49 List<List<Transformer>> get phasesForSmoke =>
46 [[new MirrorsRemover.asPlugin()]]; 50 [[new MirrorsRemover.asPlugin()]];
47 51
48 _error() => throw new StateError("Couldn't remove imports to mirrors, maybe " 52 _error() => throw new StateError("Couldn't remove imports to mirrors, maybe "
49 "polymer.dart was modified, but mirrors_remover.dart wasn't."); 53 "polymer.dart was modified, but mirrors_remover.dart wasn't.");
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/linter.dart ('k') | pkg/polymer/lib/src/build/script_compactor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698