| 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 class JavaScriptPrintingOptions { | 8 class JavaScriptPrintingOptions { |
| 9 final bool shouldCompressOutput; | 9 final bool shouldCompressOutput; |
| 10 final bool minifyLocalVariables; | 10 final bool minifyLocalVariables; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 newInForInit: newInForInit, | 205 newInForInit: newInForInit, |
| 206 newAtStatementBegin: newAtStatementBegin); | 206 newAtStatementBegin: newAtStatementBegin); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 visitAll(List<Node> nodes) { | 210 visitAll(List<Node> nodes) { |
| 211 nodes.forEach(visit); | 211 nodes.forEach(visit); |
| 212 } | 212 } |
| 213 | 213 |
| 214 visitProgram(Program program) { | 214 visitProgram(Program program) { |
| 215 if (program.scriptTag != null) { |
| 216 out('#!${program.scriptTag}\n'); |
| 217 } |
| 215 visitAll(program.body); | 218 visitAll(program.body); |
| 216 } | 219 } |
| 217 | 220 |
| 218 bool blockBody(Node body, {bool needsSeparation, bool needsNewline}) { | 221 bool blockBody(Node body, {bool needsSeparation, bool needsNewline}) { |
| 219 if (body is Block) { | 222 if (body is Block) { |
| 220 spaceOut(); | 223 spaceOut(); |
| 221 blockOut(body, false, needsNewline); | 224 blockOut(body, false, needsNewline); |
| 222 return true; | 225 return true; |
| 223 } | 226 } |
| 224 if (shouldCompressOutput && needsSeparation) { | 227 if (shouldCompressOutput && needsSeparation) { |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 declare(node.name); | 1481 declare(node.name); |
| 1479 node.function.accept(this); | 1482 node.function.accept(this); |
| 1480 } | 1483 } |
| 1481 | 1484 |
| 1482 visitClassExpression(ClassExpression node) { | 1485 visitClassExpression(ClassExpression node) { |
| 1483 declare(node.name); | 1486 declare(node.name); |
| 1484 if (node.heritage != null) node.heritage.accept(this); | 1487 if (node.heritage != null) node.heritage.accept(this); |
| 1485 for (Method element in node.methods) element.accept(this); | 1488 for (Method element in node.methods) element.accept(this); |
| 1486 } | 1489 } |
| 1487 } | 1490 } |
| OLD | NEW |