| 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; | 5 part of js; |
| 6 | 6 |
| 7 class Printer extends Indentation implements NodeVisitor { | 7 class Printer extends Indentation implements NodeVisitor { |
| 8 final bool shouldCompressOutput; | 8 final bool shouldCompressOutput; |
| 9 leg.Compiler compiler; | 9 leg.Compiler compiler; |
| 10 leg.CodeBuffer outBuffer; | 10 leg.CodeBuffer outBuffer; |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 visit(inputs[i]); | 867 visit(inputs[i]); |
| 868 out(parts[i + 1]); | 868 out(parts[i + 1]); |
| 869 } | 869 } |
| 870 } | 870 } |
| 871 | 871 |
| 872 visitLiteralStatement(LiteralStatement node) { | 872 visitLiteralStatement(LiteralStatement node) { |
| 873 outLn(node.code); | 873 outLn(node.code); |
| 874 } | 874 } |
| 875 | 875 |
| 876 visitInterpolatedNode(InterpolatedNode node) { | 876 visitInterpolatedNode(InterpolatedNode node) { |
| 877 out('#${node.name}'); | 877 out('#${node.nameOrPosition}'); |
| 878 } | 878 } |
| 879 | 879 |
| 880 visitInterpolatedExpression(InterpolatedExpression node) => | 880 visitInterpolatedExpression(InterpolatedExpression node) => |
| 881 visitInterpolatedNode(node); | 881 visitInterpolatedNode(node); |
| 882 | 882 |
| 883 visitInterpolatedLiteral(InterpolatedLiteral node) => | 883 visitInterpolatedLiteral(InterpolatedLiteral node) => |
| 884 visitInterpolatedNode(node); | 884 visitInterpolatedNode(node); |
| 885 | 885 |
| 886 visitInterpolatedParameter(InterpolatedParameter node) => | 886 visitInterpolatedParameter(InterpolatedParameter node) => |
| 887 visitInterpolatedNode(node); | 887 visitInterpolatedNode(node); |
| 888 | 888 |
| 889 visitInterpolatedSelector(InterpolatedSelector node) => | 889 visitInterpolatedSelector(InterpolatedSelector node) => |
| 890 visitInterpolatedNode(node); | 890 visitInterpolatedNode(node); |
| 891 | 891 |
| 892 visitInterpolatedStatement(InterpolatedStatement node) { | 892 visitInterpolatedStatement(InterpolatedStatement node) { |
| 893 outLn('#${node.name}'); | 893 outLn('#${node.nameOrPosition}'); |
| 894 } | 894 } |
| 895 | 895 |
| 896 void visitComment(Comment node) { | 896 void visitComment(Comment node) { |
| 897 if (shouldCompressOutput) return; | 897 if (shouldCompressOutput) return; |
| 898 String comment = node.comment.trim(); | 898 String comment = node.comment.trim(); |
| 899 if (comment.isEmpty) return; | 899 if (comment.isEmpty) return; |
| 900 for (var line in comment.split('\n')) { | 900 for (var line in comment.split('\n')) { |
| 901 if (comment.startsWith('//')) { | 901 if (comment.startsWith('//')) { |
| 902 outIndentLn(line.trim()); | 902 outIndentLn(line.trim()); |
| 903 } else { | 903 } else { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); | 1168 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); |
| 1169 } | 1169 } |
| 1170 codes.add(charCodes.$0 + digit); | 1170 codes.add(charCodes.$0 + digit); |
| 1171 newName = new String.fromCharCodes(codes); | 1171 newName = new String.fromCharCodes(codes); |
| 1172 } | 1172 } |
| 1173 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); | 1173 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); |
| 1174 maps.last[oldName] = newName; | 1174 maps.last[oldName] = newName; |
| 1175 return newName; | 1175 return newName; |
| 1176 } | 1176 } |
| 1177 } | 1177 } |
| OLD | NEW |