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

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

Issue 201483002: Cleanup for pkg/observe and pkg/polymer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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) 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 // written. Make sure both are updated in sync. 25 // written. Make sure both are updated in sync.
26 var start = code.indexOf('@MirrorsUsed'); 26 var start = code.indexOf('@MirrorsUsed');
27 if (start == -1) _error(); 27 if (start == -1) _error();
28 var end = code.indexOf('show MirrorsUsed;', start); 28 var end = code.indexOf('show MirrorsUsed;', start);
29 if (end == -1) _error(); 29 if (end == -1) _error();
30 var loaderImport = code.indexOf( 30 var loaderImport = code.indexOf(
31 "import 'src/mirror_loader.dart' as loader;", end); 31 "import 'src/mirror_loader.dart' as loader;", end);
32 if (loaderImport == -1) _error(); 32 if (loaderImport == -1) _error();
33 var sb = new StringBuffer() 33 var sb = new StringBuffer()
34 ..write(code.substring(0, start)) 34 ..write(code.substring(0, start))
35 ..write(code.susbtring(end) 35 ..write(code.substring(end)
kevmoo 2014/03/17 01:35:03 Clearly this code is not being run...
Siggi Cherem (dart-lang) 2014/03/17 17:45:18 yeah - I have a fix on my local client. Feel free
36 .replaceAll('src/mirror_loader.dart', 'src/static_loader.dart')); 36 .replaceAll('src/mirror_loader.dart', 'src/static_loader.dart'));
37 37
38 transform.addOutput(new Asset.fromString(id, sb.toString())); 38 transform.addOutput(new Asset.fromString(id, sb.toString()));
39 }); 39 });
40 } 40 }
41 } 41 }
42 42
43 /** Transformer phases which should be applied to the smoke package. */ 43 /** Transformer phases which should be applied to the smoke package. */
44 List<List<Transformer>> get phasesForSmoke => 44 List<List<Transformer>> get phasesForSmoke =>
45 [[new MirrorsRemover.asPlugin()]]; 45 [[new MirrorsRemover.asPlugin()]];
46 46
47 _error() => throw new StateError("Couldn't remove imports to mirrors, maybe " 47 _error() => throw new StateError("Couldn't remove imports to mirrors, maybe "
48 "polymer.dart was modified, but mirrors_remover.dart wasn't."); 48 "polymer.dart was modified, but mirrors_remover.dart wasn't.");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698