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

Side by Side Diff: pkg/compiler/lib/src/js/printer.dart

Issue 932053002: Support for interpolated declarations in the js parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review Created 5 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/js/nodes.dart ('k') | pkg/compiler/lib/src/js/rewrite_async.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 visitInterpolatedParameter(InterpolatedParameter node) => 962 visitInterpolatedParameter(InterpolatedParameter node) =>
963 visitInterpolatedNode(node); 963 visitInterpolatedNode(node);
964 964
965 visitInterpolatedSelector(InterpolatedSelector node) => 965 visitInterpolatedSelector(InterpolatedSelector node) =>
966 visitInterpolatedNode(node); 966 visitInterpolatedNode(node);
967 967
968 visitInterpolatedStatement(InterpolatedStatement node) { 968 visitInterpolatedStatement(InterpolatedStatement node) {
969 outLn('#${node.nameOrPosition}'); 969 outLn('#${node.nameOrPosition}');
970 } 970 }
971 971
972 visitInterpolatedDeclaration(InterpolatedDeclaration node) {
973 visitInterpolatedNode(node);
974 }
975
972 void visitComment(Comment node) { 976 void visitComment(Comment node) {
973 if (shouldCompressOutput) return; 977 if (shouldCompressOutput) return;
974 String comment = node.comment.trim(); 978 String comment = node.comment.trim();
975 if (comment.isEmpty) return; 979 if (comment.isEmpty) return;
976 for (var line in comment.split('\n')) { 980 for (var line in comment.split('\n')) {
977 if (comment.startsWith('//')) { 981 if (comment.startsWith('//')) {
978 outIndentLn(line.trim()); 982 outIndentLn(line.trim());
979 } else { 983 } else {
980 outIndentLn('// ${line.trim()}'); 984 outIndentLn('// ${line.trim()}');
981 } 985 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); 1242 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS));
1239 } 1243 }
1240 codes.add(charCodes.$0 + digit); 1244 codes.add(charCodes.$0 + digit);
1241 newName = new String.fromCharCodes(codes); 1245 newName = new String.fromCharCodes(codes);
1242 } 1246 }
1243 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); 1247 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
1244 maps.last[oldName] = newName; 1248 maps.last[oldName] = newName;
1245 return newName; 1249 return newName;
1246 } 1250 }
1247 } 1251 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/nodes.dart ('k') | pkg/compiler/lib/src/js/rewrite_async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698