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

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

Issue 12299008: Stop resolving all of js_helper unconditionally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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_helper; 5 part of _js_helper;
6 6
7 class StringMatch implements Match { 7 class StringMatch implements Match {
8 const StringMatch(int this.start, 8 const StringMatch(int this.start,
9 String this.str, 9 String this.str,
10 String this.pattern); 10 String this.pattern);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 stringReplaceJS(receiver, replacer, to) { 72 stringReplaceJS(receiver, replacer, to) {
73 // The JavaScript String.replace method recognizes replacement 73 // The JavaScript String.replace method recognizes replacement
74 // patterns in the replacement string. Dart does not have that 74 // patterns in the replacement string. Dart does not have that
75 // behavior. 75 // behavior.
76 to = JS('String', r"#.replace('$', '$$$$')", to); 76 to = JS('String', r"#.replace('$', '$$$$')", to);
77 return JS('String', r'#.replace(#, #)', receiver, replacer, to); 77 return JS('String', r'#.replace(#, #)', receiver, replacer, to);
78 } 78 }
79 79
80 final RegExp quoteRegExp = new JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]'); 80 final RegExp quoteRegExp = const JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]');
81 81
82 stringReplaceAllUnchecked(receiver, from, to) { 82 stringReplaceAllUnchecked(receiver, from, to) {
83 checkString(to); 83 checkString(to);
84 if (from is String) { 84 if (from is String) {
85 if (from == "") { 85 if (from == "") {
86 if (receiver == "") { 86 if (receiver == "") {
87 return to; 87 return to;
88 } else { 88 } else {
89 StringBuffer result = new StringBuffer(); 89 StringBuffer result = new StringBuffer();
90 int length = receiver.length; 90 int length = receiver.length;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void addCharCode(int charCode) { 225 void addCharCode(int charCode) {
226 add(new String.fromCharCodes([charCode])); 226 add(new String.fromCharCodes([charCode]));
227 } 227 }
228 228
229 void clear() { 229 void clear() {
230 _contents = ""; 230 _contents = "";
231 } 231 }
232 232
233 String toString() => _contents; 233 String toString() => _contents;
234 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698