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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 functionOut(namedFunction.function, namedFunction.name); | 938 functionOut(namedFunction.function, namedFunction.name); |
939 } | 939 } |
940 | 940 |
941 visitFun(Fun fun) { | 941 visitFun(Fun fun) { |
942 functionOut(fun, null); | 942 functionOut(fun, null); |
943 } | 943 } |
944 | 944 |
945 visitArrowFun(ArrowFun fun) { | 945 visitArrowFun(ArrowFun fun) { |
946 localNamer.enterScope(fun); | 946 localNamer.enterScope(fun); |
947 if (fun.params.length == 1 && | 947 if (fun.params.length == 1 && |
948 (fun.params.single.type == null || !options.emitTypes)) { | 948 fun.params[0] is Identifier && |
| 949 (!options.emitTypes || fun.params[0].type == null)) { |
949 visitNestedExpression(fun.params.single, SPREAD, | 950 visitNestedExpression(fun.params.single, SPREAD, |
950 newInForInit: false, newAtStatementBegin: false); | 951 newInForInit: false, newAtStatementBegin: false); |
951 } else { | 952 } else { |
952 out("("); | 953 out("("); |
953 visitCommaSeparated(fun.params, SPREAD, | 954 visitCommaSeparated(fun.params, SPREAD, |
954 newInForInit: false, newAtStatementBegin: false); | 955 newInForInit: false, newAtStatementBegin: false); |
955 out(")"); | 956 out(")"); |
956 } | 957 } |
957 outTypeAnnotation(fun.returnType); | 958 outTypeAnnotation(fun.returnType); |
958 spaceOut(); | 959 spaceOut(); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 declare(node.name); | 1700 declare(node.name); |
1700 node.function.accept(this); | 1701 node.function.accept(this); |
1701 } | 1702 } |
1702 | 1703 |
1703 visitClassExpression(ClassExpression node) { | 1704 visitClassExpression(ClassExpression node) { |
1704 declare(node.name); | 1705 declare(node.name); |
1705 if (node.heritage != null) node.heritage.accept(this); | 1706 if (node.heritage != null) node.heritage.accept(this); |
1706 for (Method element in node.methods) element.accept(this); | 1707 for (Method element in node.methods) element.accept(this); |
1707 } | 1708 } |
1708 } | 1709 } |
OLD | NEW |