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 class JavaScriptPrintingOptions { | 7 class JavaScriptPrintingOptions { |
8 final bool shouldCompressOutput; | 8 final bool shouldCompressOutput; |
9 final bool minifyLocalVariables; | 9 final bool minifyLocalVariables; |
10 final bool preferSemicolonToNewlineInMinifiedOutput; | 10 final bool preferSemicolonToNewlineInMinifiedOutput; |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 visitNestedExpression(node.value, ASSIGNMENT, | 1065 visitNestedExpression(node.value, ASSIGNMENT, |
1066 newInForInit: false, newAtStatementBegin: false); | 1066 newInForInit: false, newAtStatementBegin: false); |
1067 } | 1067 } |
1068 | 1068 |
1069 visitRegExpLiteral(RegExpLiteral node) { | 1069 visitRegExpLiteral(RegExpLiteral node) { |
1070 out(node.pattern); | 1070 out(node.pattern); |
1071 } | 1071 } |
1072 | 1072 |
1073 visitTemplateString(TemplateString node) { | 1073 visitTemplateString(TemplateString node) { |
1074 out('`'); | 1074 out('`'); |
1075 for (var element in node.elements) { | 1075 int len = node.interpolations.length; |
1076 if (element is String) { | 1076 for (var i = 0; i < len; i++) { |
1077 out(element); | 1077 out(node.strings[i]); |
1078 } else { | 1078 out(r'${'); |
1079 out(r'${'); | 1079 visit(node.interpolations[i]); |
1080 visit(element); | 1080 out('}'); |
1081 out('}'); | |
1082 } | |
1083 } | 1081 } |
| 1082 out(node.strings[len]); |
1084 out('`'); | 1083 out('`'); |
1085 } | 1084 } |
1086 | 1085 |
1087 visitTaggedTemplate(TaggedTemplate node) { | 1086 visitTaggedTemplate(TaggedTemplate node) { |
1088 visit(node.tag); | 1087 visit(node.tag); |
1089 visit(node.template); | 1088 visit(node.template); |
1090 } | 1089 } |
1091 | 1090 |
1092 visitClassDeclaration(ClassDeclaration node) { | 1091 visitClassDeclaration(ClassDeclaration node) { |
1093 indent(); | 1092 indent(); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 declare(node.name); | 1699 declare(node.name); |
1701 node.function.accept(this); | 1700 node.function.accept(this); |
1702 } | 1701 } |
1703 | 1702 |
1704 visitClassExpression(ClassExpression node) { | 1703 visitClassExpression(ClassExpression node) { |
1705 declare(node.name); | 1704 declare(node.name); |
1706 if (node.heritage != null) node.heritage.accept(this); | 1705 if (node.heritage != null) node.heritage.accept(this); |
1707 for (Method element in node.methods) element.accept(this); | 1706 for (Method element in node.methods) element.accept(this); |
1708 } | 1707 } |
1709 } | 1708 } |
OLD | NEW |