| 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 | 821 |
| 822 visitFun(Fun fun) { | 822 visitFun(Fun fun) { |
| 823 functionOut(fun, null, fun); | 823 functionOut(fun, null, fun); |
| 824 } | 824 } |
| 825 | 825 |
| 826 visitArrowFun(ArrowFun fun) { | 826 visitArrowFun(ArrowFun fun) { |
| 827 if (fun.bindThisWorkaround) { | 827 if (fun.bindThisWorkaround) { |
| 828 out("("); | 828 out("("); |
| 829 } | 829 } |
| 830 localNamer.enterScope(fun); | 830 localNamer.enterScope(fun); |
| 831 out("("); | 831 if (fun.params.length == 1) { |
| 832 if (fun.params != null) { | 832 visitNestedExpression(fun.params.single, PRIMARY, |
| 833 newInForInit: false, newAtStatementBegin: false); |
| 834 } else { |
| 835 out("("); |
| 833 visitCommaSeparated(fun.params, PRIMARY, | 836 visitCommaSeparated(fun.params, PRIMARY, |
| 834 newInForInit: false, newAtStatementBegin: false); | 837 newInForInit: false, newAtStatementBegin: false); |
| 838 out(")"); |
| 835 } | 839 } |
| 836 out(")"); | |
| 837 spaceOut(); | 840 spaceOut(); |
| 838 out("=>"); | 841 out("=>"); |
| 839 if (fun.body is Expression) { | 842 if (fun.body is Expression) { |
| 840 spaceOut(); | 843 spaceOut(); |
| 841 fun.body.accept(this); | 844 visitNestedExpression(fun.body, ASSIGNMENT, |
| 845 newInForInit: false, newAtStatementBegin: false); |
| 842 } else { | 846 } else { |
| 843 blockBody(fun.body, needsSeparation: false, needsNewline: false); | 847 blockBody(fun.body, needsSeparation: false, needsNewline: false); |
| 844 } | 848 } |
| 845 localNamer.leaveScope(); | 849 localNamer.leaveScope(); |
| 846 if (fun.bindThisWorkaround) { | 850 if (fun.bindThisWorkaround) { |
| 847 out(").bind(this)"); | 851 out(").bind(this)"); |
| 848 } | 852 } |
| 849 } | 853 } |
| 850 | 854 |
| 851 visitLiteralBool(LiteralBool node) { | 855 visitLiteralBool(LiteralBool node) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1379 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
| 1376 } | 1380 } |
| 1377 codes.add(charCodes.$0 + digit); | 1381 codes.add(charCodes.$0 + digit); |
| 1378 newName = new String.fromCharCodes(codes); | 1382 newName = new String.fromCharCodes(codes); |
| 1379 } | 1383 } |
| 1380 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1384 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
| 1381 maps.last[oldName] = newName; | 1385 maps.last[oldName] = newName; |
| 1382 return newName; | 1386 return newName; |
| 1383 } | 1387 } |
| 1384 } | 1388 } |
| OLD | NEW |