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

Unified Diff: dart/site/try/poi/poi.dart

Issue 636903002: Compute an incremental patch to JavaScript code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use Namer.elementAccess (to address Johnni's comment) Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/site/try/poi/patcher.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/poi/poi.dart
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart
index f0f61a1f789a63a6dc06f8b9423b25acccccfe9f..cdc400c5bbb7c40a3c27463451c9d7e84a2473ef 100644
--- a/dart/site/try/poi/poi.dart
+++ b/dart/site/try/poi/poi.dart
@@ -61,7 +61,7 @@ import 'package:compiler/implementation/scanner/scannerlib.dart' show
Token;
import 'package:compiler/implementation/js/js.dart' show
- prettyPrint;
+ js;
/// Enabled by the option --enable-dart-mind. Controls if this program should
/// be querying Dart Mind.
@@ -96,6 +96,10 @@ bool isVerbose = false;
/// the POI.
bool isCompiler = false;
+/// Enabled by the option --minify. Passes the same option to the compiler to
+/// generate minified output.
+bool enableMinification = false;
+
/// When true (the default value) print serialized scope information at the
/// provided position.
const bool PRINT_SCOPE_INFO =
@@ -160,6 +164,9 @@ main(List<String> arguments) {
case '--compile':
isCompiler = true;
break;
+ case '--minify':
+ enableMinification = true;
+ break;
default:
throw 'Unknown option: $argument.';
}
@@ -212,7 +219,7 @@ api.CompilerInputProvider simulateMutation(
cache = new io.File(cachedFileName).readAsBytes().then((data) {
printVerbose(
'Read file $cachedFileName: '
- '${UTF8.decode(data.sublist(0, 100), allowMalformed: true)}...');
+ '${UTF8.decode(data.take(100).toList(), allowMalformed: true)}...');
return data;
});
count++;
@@ -386,6 +393,10 @@ Future<Element> runPoi(
options.add('--analyze-only');
}
+ if (enableMinification) {
+ options.add('--minify');
+ }
+
LibraryUpdater updater =
new LibraryUpdater(
cachedCompiler, inputProvider, script, printWallClock, printVerbose);
@@ -430,25 +441,10 @@ Future<Element> runPoiInternal(
Future<bool> compilation;
if (updater.hasPendingUpdates) {
- List<Element> updatedElements = updater.applyUpdates();
compilation = new Future(() {
- cachedCompiler.progress.reset();
- for (Element element in updatedElements) {
- cachedCompiler.enqueuer.resolution.addToWorkList(element);
- }
- cachedCompiler.processQueue(cachedCompiler.enqueuer.resolution, null);
-
- cachedCompiler.phase = Compiler.PHASE_DONE_RESOLVING;
-
- for (Element element in updatedElements) {
- cachedCompiler.enqueuer.codegen.addToWorkList(element);
- }
- cachedCompiler.processQueue(cachedCompiler.enqueuer.codegen, null);
-
- for (Element element in updatedElements) {
- var node = cachedCompiler.enqueuer.codegen.generatedCode[element];
- print(prettyPrint(node, cachedCompiler).getText());
- }
+ var node = js.statement(
+ r'var $dart_patch = #', js.escapedString(updater.computeUpdateJs()));
+ print(updater.prettyPrintJs(node));
return !cachedCompiler.compilationFailed;
});
« no previous file with comments | « dart/site/try/poi/patcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698