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

Unified Diff: pkg/compiler/lib/src/js/printer.dart

Issue 812233004: Add CodeOutput to prepare for emission without in-memory buffers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reinsert return. Created 6 years 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 | « pkg/compiler/lib/src/js/nodes.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/printer.dart
diff --git a/pkg/compiler/lib/src/js/printer.dart b/pkg/compiler/lib/src/js/printer.dart
index 11c39cb1a260a6f4d80bdd06c86d27d5c77e18d7..b5bce3d2ff845228da321d15ef4c1a0117d4f23a 100644
--- a/pkg/compiler/lib/src/js/printer.dart
+++ b/pkg/compiler/lib/src/js/printer.dart
@@ -7,7 +7,7 @@ part of js;
class Printer extends Indentation implements NodeVisitor {
final bool shouldCompressOutput;
leg.Compiler compiler;
- leg.CodeBuffer outBuffer;
+ CodeBuffer outBuffer;
bool inForInit = false;
bool atStatementBegin = false;
final DanglingElseVisitor danglingElseVisitor;
@@ -24,7 +24,7 @@ class Printer extends Indentation implements NodeVisitor {
: shouldCompressOutput = compiler.enableMinification,
monitor = monitor,
this.compiler = compiler,
- outBuffer = new leg.CodeBuffer(),
+ outBuffer = new CodeBuffer(),
danglingElseVisitor = new DanglingElseVisitor(compiler),
localNamer = determineRenamer(compiler.enableMinification,
allowVariableMinification);
@@ -58,7 +58,7 @@ class Printer extends Indentation implements NodeVisitor {
if (str != "") {
if (pendingSemicolon) {
if (!shouldCompressOutput) {
- outBuffer.add(";");
+ outBuffer.write(";");
} else if (str != "}") {
// We want to output newline instead of semicolon because it makes
// the raw stack traces much easier to read and it also makes line-
@@ -72,19 +72,19 @@ class Printer extends Indentation implements NodeVisitor {
// is escaped in strings, it is a lot easier to deal with semicolons
// than newlines because the former doesn't need escaping.
if (USE_NEW_EMITTER || expressionContinuationRegExp.hasMatch(str)) {
- outBuffer.add(";");
+ outBuffer.write(";");
} else {
- outBuffer.add("\n");
+ outBuffer.write("\n");
}
}
}
if (pendingSpace &&
(!shouldCompressOutput || identifierCharacterRegExp.hasMatch(str))) {
- outBuffer.add(" ");
+ outBuffer.write(" ");
}
pendingSpace = false;
pendingSemicolon = false;
- outBuffer.add(str);
+ outBuffer.write(str);
lastAddedString = str;
}
}
@@ -1026,9 +1026,9 @@ class DanglingElseVisitor extends BaseVisitor<bool> {
}
-leg.CodeBuffer prettyPrint(Node node, leg.Compiler compiler,
- {DumpInfoTask monitor,
- allowVariableMinification: true}) {
+CodeBuffer prettyPrint(Node node, leg.Compiler compiler,
+ {DumpInfoTask monitor,
+ bool allowVariableMinification: true}) {
Printer printer =
new Printer(compiler, monitor,
allowVariableMinification: allowVariableMinification);
« no previous file with comments | « pkg/compiler/lib/src/js/nodes.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698