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

Unified Diff: lib/compiler/implementation/js/printer.dart

Issue 11361037: Fix semicolon elision in non-minified mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/js/printer.dart
diff --git a/lib/compiler/implementation/js/printer.dart b/lib/compiler/implementation/js/printer.dart
index 901c32b020936f5f80aab048ffe5f7d2ae4d4e7d..eaa8579b8e5f35bdcee88bdd843e1f16a8d3fb2e 100644
--- a/lib/compiler/implementation/js/printer.dart
+++ b/lib/compiler/implementation/js/printer.dart
@@ -64,6 +64,14 @@ class Printer implements NodeVisitor {
lineOut();
}
+ void outSemicolonLn() {
+ if (shouldCompressOutput) {
+ pendingSemicolon = true;
+ } else {
+ out(";\n");
+ }
+ }
+
void outIndent(String str) { indent(); out(str); }
void outIndentLn(String str) { indent(); outLn(str); }
void indent() {
@@ -155,7 +163,7 @@ class Printer implements NodeVisitor {
indent();
visitNestedExpression(expressionStatement.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: true);
- pendingSemicolon = true;
+ outSemicolonLn();
}
visitEmptyStatement(EmptyStatement nop) {
@@ -263,8 +271,8 @@ class Printer implements NodeVisitor {
out("(");
visitNestedExpression(loop.condition, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
- outLn(")");
- pendingSemicolon = true;
+ out(")");
+ outSemicolonLn();
}
visitContinue(Continue node) {
@@ -294,7 +302,7 @@ class Printer implements NodeVisitor {
visitNestedExpression(node.value, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
}
- pendingSemicolon = true;
+ outSemicolonLn();
}
visitThrow(Throw node) {
@@ -302,7 +310,7 @@ class Printer implements NodeVisitor {
pendingSpace = true;
visitNestedExpression(node.expression, EXPRESSION,
newInForInit: false, newAtStatementBegin: false);
- pendingSemicolon = true;
+ outSemicolonLn();
}
visitTry(Try node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698