| 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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 817 |
| 818 visitNamedFunction(NamedFunction namedFunction) { | 818 visitNamedFunction(NamedFunction namedFunction) { |
| 819 functionOut(namedFunction.function, namedFunction.name, namedFunction); | 819 functionOut(namedFunction.function, namedFunction.name, namedFunction); |
| 820 } | 820 } |
| 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) { |
| 828 out("("); |
| 829 } |
| 827 localNamer.enterScope(fun); | 830 localNamer.enterScope(fun); |
| 828 out("("); | 831 out("("); |
| 829 if (fun.params != null) { | 832 if (fun.params != null) { |
| 830 visitCommaSeparated(fun.params, PRIMARY, | 833 visitCommaSeparated(fun.params, PRIMARY, |
| 831 newInForInit: false, newAtStatementBegin: false); | 834 newInForInit: false, newAtStatementBegin: false); |
| 832 } | 835 } |
| 833 out(")"); | 836 out(")"); |
| 834 spaceOut(); | 837 spaceOut(); |
| 835 out("=>"); | 838 out("=>"); |
| 836 if (fun.body is Expression) { | 839 if (fun.body is Expression) { |
| 837 spaceOut(); | 840 spaceOut(); |
| 838 fun.body.accept(this); | 841 fun.body.accept(this); |
| 839 } else { | 842 } else { |
| 840 blockBody(fun.body, needsSeparation: false, needsNewline: false); | 843 blockBody(fun.body, needsSeparation: false, needsNewline: false); |
| 841 } | 844 } |
| 842 localNamer.leaveScope(); | 845 localNamer.leaveScope(); |
| 846 if (fun.bindThisWorkaround) { |
| 847 out(").bind(this)"); |
| 848 } |
| 843 } | 849 } |
| 844 | 850 |
| 845 visitLiteralBool(LiteralBool node) { | 851 visitLiteralBool(LiteralBool node) { |
| 846 out(node.value ? "true" : "false"); | 852 out(node.value ? "true" : "false"); |
| 847 } | 853 } |
| 848 | 854 |
| 849 visitLiteralString(LiteralString node) { | 855 visitLiteralString(LiteralString node) { |
| 850 out(node.value); | 856 out(node.value); |
| 851 } | 857 } |
| 852 | 858 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1371 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
| 1366 } | 1372 } |
| 1367 codes.add(charCodes.$0 + digit); | 1373 codes.add(charCodes.$0 + digit); |
| 1368 newName = new String.fromCharCodes(codes); | 1374 newName = new String.fromCharCodes(codes); |
| 1369 } | 1375 } |
| 1370 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1376 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
| 1371 maps.last[oldName] = newName; | 1377 maps.last[oldName] = newName; |
| 1372 return newName; | 1378 return newName; |
| 1373 } | 1379 } |
| 1374 } | 1380 } |
| OLD | NEW |