Chromium Code Reviews| 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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 955 } | 955 } |
| 956 | 956 |
| 957 visitClassExpression(ClassExpression node) { | 957 visitClassExpression(ClassExpression node) { |
| 958 out('class '); | 958 out('class '); |
| 959 visit(node.name); | 959 visit(node.name); |
| 960 if (node.heritage != null) { | 960 if (node.heritage != null) { |
| 961 out(' extends '); | 961 out(' extends '); |
| 962 visit(node.heritage); | 962 visit(node.heritage); |
| 963 } | 963 } |
| 964 spaceOut(); | 964 spaceOut(); |
| 965 out('{'); | 965 if (node.methods.isNotEmpty) { |
| 966 lineOut(); | 966 out('{'); |
| 967 indentMore(); | 967 lineOut(); |
| 968 for (var method in node.methods) { | 968 indentMore(); |
| 969 for (var method in node.methods) { | |
| 970 indent(); | |
| 971 visit(method); | |
| 972 lineOut(); | |
| 973 } | |
| 974 indentLess(); | |
| 969 indent(); | 975 indent(); |
| 970 visit(method); | 976 out('}'); |
| 971 lineOut(); | 977 } else { |
| 978 out('{}'); | |
|
Jennifer Messerly
2015/04/01 22:31:31
i've done this a few times but somehow keeps not e
| |
| 972 } | 979 } |
| 973 indentLess(); | |
| 974 indent(); | |
| 975 out('}'); | |
| 976 } | 980 } |
| 977 | 981 |
| 978 visitMethod(Method node) { | 982 visitMethod(Method node) { |
| 979 if (node.isStatic) { | 983 if (node.isStatic) { |
| 980 out('static '); | 984 out('static '); |
| 981 } | 985 } |
| 982 if (node.isGetter) { | 986 if (node.isGetter) { |
| 983 out('get '); | 987 out('get '); |
| 984 } else if (node.isSetter) { | 988 } else if (node.isSetter) { |
| 985 out('set '); | 989 out('set '); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1365 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1369 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
| 1366 } | 1370 } |
| 1367 codes.add(charCodes.$0 + digit); | 1371 codes.add(charCodes.$0 + digit); |
| 1368 newName = new String.fromCharCodes(codes); | 1372 newName = new String.fromCharCodes(codes); |
| 1369 } | 1373 } |
| 1370 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1374 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
| 1371 maps.last[oldName] = newName; | 1375 maps.last[oldName] = newName; |
| 1372 return newName; | 1376 return newName; |
| 1373 } | 1377 } |
| 1374 } | 1378 } |
| OLD | NEW |