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

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

Issue 15263004: Adding isNotEmpty property to collection and string. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix template generation Created 7 years, 6 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 _interceptors; 5 part of _interceptors;
6 6
7 /** 7 /**
8 * The interceptor class for [String]. The compiler recognizes this 8 * The interceptor class for [String]. The compiler recognizes this
9 * class as an interceptor, and changes references to [:this:] to 9 * class as an interceptor, and changes references to [:this:] to
10 * actually use the receiver of the method, which is generated as an extra 10 * actually use the receiver of the method, which is generated as an extra
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return stringLastIndexOfUnchecked(this, other, start); 220 return stringLastIndexOfUnchecked(this, other, start);
221 } 221 }
222 222
223 bool contains(Pattern other, [int startIndex = 0]) { 223 bool contains(Pattern other, [int startIndex = 0]) {
224 checkNull(other); 224 checkNull(other);
225 return stringContainsUnchecked(this, other, startIndex); 225 return stringContainsUnchecked(this, other, startIndex);
226 } 226 }
227 227
228 bool get isEmpty => length == 0; 228 bool get isEmpty => length == 0;
229 229
230 bool get isNotEmpty => !isEmpty;
231
230 int compareTo(String other) { 232 int compareTo(String other) {
231 if (other is !String) throw new ArgumentError(other); 233 if (other is !String) throw new ArgumentError(other);
232 return this == other ? 0 234 return this == other ? 0
233 : JS('bool', r'# < #', this, other) ? -1 : 1; 235 : JS('bool', r'# < #', this, other) ? -1 : 1;
234 } 236 }
235 237
236 // Note: if you change this, also change the function [S]. 238 // Note: if you change this, also change the function [S].
237 String toString() => this; 239 String toString() => this;
238 240
239 /** 241 /**
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 */ 274 */
273 class _CodeUnits extends UnmodifiableListBase<int> { 275 class _CodeUnits extends UnmodifiableListBase<int> {
274 /** The string that this is the code units of. */ 276 /** The string that this is the code units of. */
275 String _string; 277 String _string;
276 278
277 _CodeUnits(this._string); 279 _CodeUnits(this._string);
278 280
279 int get length => _string.length; 281 int get length => _string.length;
280 int operator[](int i) => _string.codeUnitAt(i); 282 int operator[](int i) => _string.codeUnitAt(i);
281 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698