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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 | 1263 |
1264 fromClauseOut(LiteralString from) { | 1264 fromClauseOut(LiteralString from) { |
1265 if (from != null) { | 1265 if (from != null) { |
1266 out(' from'); | 1266 out(' from'); |
1267 spaceOut(); | 1267 spaceOut(); |
1268 visit(from); | 1268 visit(from); |
1269 } | 1269 } |
1270 } | 1270 } |
1271 | 1271 |
1272 visitNameSpecifier(NameSpecifier node) { | 1272 visitNameSpecifier(NameSpecifier node) { |
1273 out(node.name); | 1273 if (node.isStar) { |
| 1274 out('*'); |
| 1275 } else { |
| 1276 var importName = node.name.name; |
| 1277 out(importName); |
| 1278 |
| 1279 if (node.asName == null) { |
| 1280 // If our local was renamed, generate an implicit "as". |
| 1281 // This is a convenience feature so imports can be renamed. |
| 1282 var localName = localNamer.getName(node.name); |
| 1283 if (localName != importName) { |
| 1284 out(' as '); |
| 1285 out(localName); |
| 1286 } |
| 1287 } |
| 1288 } |
1274 if (node.asName != null) { | 1289 if (node.asName != null) { |
1275 out(' as '); | 1290 out(' as '); |
1276 out(node.asName); | 1291 visitIdentifier(node.asName); |
1277 } | 1292 } |
1278 } | 1293 } |
1279 | 1294 |
1280 visitModule(Module node) { | 1295 visitModule(Module node) { |
1281 visitAll(node.body); | 1296 visitAll(node.body); |
1282 } | 1297 } |
1283 | 1298 |
1284 visitLiteralExpression(LiteralExpression node) { | 1299 visitLiteralExpression(LiteralExpression node) { |
1285 String template = node.template; | 1300 String template = node.template; |
1286 List<Expression> inputs = node.inputs; | 1301 List<Expression> inputs = node.inputs; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 declare(node.name); | 1697 declare(node.name); |
1683 node.function.accept(this); | 1698 node.function.accept(this); |
1684 } | 1699 } |
1685 | 1700 |
1686 visitClassExpression(ClassExpression node) { | 1701 visitClassExpression(ClassExpression node) { |
1687 declare(node.name); | 1702 declare(node.name); |
1688 if (node.heritage != null) node.heritage.accept(this); | 1703 if (node.heritage != null) node.heritage.accept(this); |
1689 for (Method element in node.methods) element.accept(this); | 1704 for (Method element in node.methods) element.accept(this); |
1690 } | 1705 } |
1691 } | 1706 } |
OLD | NEW |