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

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

Issue 11363052: Rename regexp to reflect review feedback on semicolon change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | 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; 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 26 matching lines...) Expand all
37 37
38 String lastAddedString = null; 38 String lastAddedString = null;
39 int get lastCharCode { 39 int get lastCharCode {
40 if (lastAddedString == null) return 0; 40 if (lastAddedString == null) return 0;
41 assert(lastAddedString.length != ""); 41 assert(lastAddedString.length != "");
42 return lastAddedString.charCodeAt(lastAddedString.length - 1); 42 return lastAddedString.charCodeAt(lastAddedString.length - 1);
43 } 43 }
44 44
45 void out(String str) { 45 void out(String str) {
46 if (str != "") { 46 if (str != "") {
47 const identifierRegexp = const RegExp(r'^[a-zA-Z_0-9$]'); 47 const identifierCharacterRegExp = const RegExp(r'^[a-zA-Z_0-9$]');
48 if (pendingSemicolon && (!shouldCompressOutput || str != "}")) { 48 if (pendingSemicolon && (!shouldCompressOutput || str != "}")) {
49 outBuffer.add(";"); 49 outBuffer.add(";");
50 } 50 }
51 if (pendingSpace && 51 if (pendingSpace &&
52 (!shouldCompressOutput || identifierRegexp.hasMatch(str))) { 52 (!shouldCompressOutput || identifierCharacterRegExp.hasMatch(str))) {
53 outBuffer.add(" "); 53 outBuffer.add(" ");
54 } 54 }
55 pendingSpace = false; 55 pendingSpace = false;
56 pendingSemicolon = false; 56 pendingSemicolon = false;
57 outBuffer.add(str); 57 outBuffer.add(str);
58 lastAddedString = str; 58 lastAddedString = str;
59 } 59 }
60 } 60 }
61 61
62 void outLn(String str) { 62 void outLn(String str) {
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 } 1004 }
1005 codes.add(charCodes.$0 + digit); 1005 codes.add(charCodes.$0 + digit);
1006 newName = new String.fromCharCodes(codes); 1006 newName = new String.fromCharCodes(codes);
1007 } 1007 }
1008 assert(const RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); 1008 assert(const RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
1009 nameNumber++; 1009 nameNumber++;
1010 maps.last[oldName] = newName; 1010 maps.last[oldName] = newName;
1011 return newName; 1011 return newName;
1012 } 1012 }
1013 } 1013 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698