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

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

Issue 12296011: Version 0.3.7.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } else { 195 } else {
196 checkNull(from); 196 checkNull(from);
197 // TODO(floitsch): implement generic String.replace (with patterns). 197 // TODO(floitsch): implement generic String.replace (with patterns).
198 throw "String.replace(Pattern) UNIMPLEMENTED"; 198 throw "String.replace(Pattern) UNIMPLEMENTED";
199 } 199 }
200 } 200 }
201 201
202 stringJoinUnchecked(array, separator) { 202 stringJoinUnchecked(array, separator) {
203 return JS('String', r'#.join(#)', array, separator); 203 return JS('String', r'#.join(#)', array, separator);
204 } 204 }
205
206 class JsStringBuffer implements StringBuffer {
207 String _contents;
208
209 JsStringBuffer(content)
210 : _contents = (content is String) ? content : '$content';
211
212 int get length => _contents.length;
213
214 bool get isEmpty => length == 0;
215
216 void add(Object obj) {
217 _contents = JS('String', '# + #', _contents,
218 (obj is String) ? obj : '$obj');
219 }
220
221 void addAll(Iterable objects) {
222 for (Object obj in objects) add(obj);
223 }
224
225 void addCharCode(int charCode) {
226 add(new String.fromCharCodes([charCode]));
227 }
228
229 void clear() {
230 _contents = "";
231 }
232
233 String toString() => _contents;
234 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | dart/sdk/lib/async/future_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698