Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js/printer.dart

Issue 238633007: Redo "Add more MiniJsParser functionality." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 implements NodeVisitor { 7 class Printer 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 880
881 visitJSExpression(JSExpression node) { 881 visitJSExpression(JSExpression node) {
882 compiler.internalError(NO_LOCATION_SPANNABLE, 882 compiler.internalError(NO_LOCATION_SPANNABLE,
883 'JSPrinter should never see a JSExpression.'); 883 'JSPrinter should never see a JSExpression.');
884 } 884 }
885 885
886 visitInterpolatedExpression(InterpolatedExpression node) { 886 visitInterpolatedExpression(InterpolatedExpression node) {
887 visit(node.value); 887 visit(node.value);
888 } 888 }
889 889
890 visitInterpolatedStatement(InterpolatedStatement node) {
891 visit(node.value);
892 }
893
890 void visitComment(Comment node) { 894 void visitComment(Comment node) {
891 if (shouldCompressOutput) return; 895 if (shouldCompressOutput) return;
892 String comment = node.comment.trim(); 896 String comment = node.comment.trim();
893 if (comment.isEmpty) return; 897 if (comment.isEmpty) return;
894 for (var line in comment.split('\n')) { 898 for (var line in comment.split('\n')) {
895 if (comment.startsWith('//')) { 899 if (comment.startsWith('//')) {
896 outIndentLn(line.trim()); 900 outIndentLn(line.trim());
897 } else { 901 } else {
898 outIndentLn('// ${line.trim()}'); 902 outIndentLn('// ${line.trim()}');
899 } 903 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); 1155 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS));
1152 } 1156 }
1153 codes.add(charCodes.$0 + digit); 1157 codes.add(charCodes.$0 + digit);
1154 newName = new String.fromCharCodes(codes); 1158 newName = new String.fromCharCodes(codes);
1155 } 1159 }
1156 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); 1160 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
1157 maps.last[oldName] = newName; 1161 maps.last[oldName] = newName;
1158 return newName; 1162 return newName;
1159 } 1163 }
1160 } 1164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698