| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of js_ast; | 5 part of js_ast; |
| 6 | 6 |
| 7 | 7 |
| 8 typedef String Renamer(Name); | 8 typedef String Renamer(Name); |
| 9 | 9 |
| 10 class JavaScriptPrintingOptions { | 10 class JavaScriptPrintingOptions { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 void spaceOut() { | 131 void spaceOut() { |
| 132 if (!shouldCompressOutput) out(" ", isWhitespace: true); | 132 if (!shouldCompressOutput) out(" ", isWhitespace: true); |
| 133 } | 133 } |
| 134 | 134 |
| 135 String lastAddedString = null; | 135 String lastAddedString = null; |
| 136 | 136 |
| 137 int get lastCharCode { | 137 int get lastCharCode { |
| 138 if (lastAddedString == null) return 0; | 138 if (lastAddedString == null) return 0; |
| 139 assert(lastAddedString.length != ""); | 139 assert(lastAddedString.length != 0); |
| 140 return lastAddedString.codeUnitAt(lastAddedString.length - 1); | 140 return lastAddedString.codeUnitAt(lastAddedString.length - 1); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void out(String str, {bool isWhitespace: false}) { | 143 void out(String str, {bool isWhitespace: false}) { |
| 144 if (str != "") { | 144 if (str != "") { |
| 145 if (pendingSemicolon) { | 145 if (pendingSemicolon) { |
| 146 if (!shouldCompressOutput) { | 146 if (!shouldCompressOutput) { |
| 147 _emit(";"); | 147 _emit(";"); |
| 148 } else if (str != "}") { | 148 } else if (str != "}") { |
| 149 // We want to output newline instead of semicolon because it makes | 149 // We want to output newline instead of semicolon because it makes |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 } | 1481 } |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 EnterExitNode exitNode(JavaScriptPrintingContext context, int position) { | 1484 EnterExitNode exitNode(JavaScriptPrintingContext context, int position) { |
| 1485 // Enter must happen before exit. | 1485 // Enter must happen before exit. |
| 1486 addToNode(context, position); | 1486 addToNode(context, position); |
| 1487 context.exitNode(node, startPosition, position, closingPosition); | 1487 context.exitNode(node, startPosition, position, closingPosition); |
| 1488 return parent; | 1488 return parent; |
| 1489 } | 1489 } |
| 1490 } | 1490 } |
| OLD | NEW |