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

Side by Side Diff: runtime/lib/integers.dart

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. 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 | « runtime/lib/immutable_map.dart ('k') | runtime/lib/string_base.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 // TODO(srdjan): fix limitations. 5 // TODO(srdjan): fix limitations.
6 // - shift amount must be a Smi. 6 // - shift amount must be a Smi.
7 class _IntegerImplementation { 7 class _IntegerImplementation {
8 factory _IntegerImplementation._uninstantiable() { 8 factory _IntegerImplementation._uninstantiable() {
9 throw new UnsupportedError( 9 throw new UnsupportedError(
10 "_IntegerImplementation can only be allocated by the VM"); 10 "_IntegerImplementation can only be allocated by the VM");
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 throw new ArgumentError(radix); 161 throw new ArgumentError(radix);
162 } 162 }
163 final bool isNegative = this < 0; 163 final bool isNegative = this < 0;
164 var value = isNegative ? -this : this; 164 var value = isNegative ? -this : this;
165 List temp = new List(); 165 List temp = new List();
166 while (value > 0) { 166 while (value > 0) {
167 var digit = value % radix; 167 var digit = value % radix;
168 value ~/= radix; 168 value ~/= radix;
169 temp.add(digit); 169 temp.add(digit);
170 } 170 }
171 if (temp.isEmpty()) { 171 if (temp.isEmpty) {
172 return "0"; 172 return "0";
173 } 173 }
174 StringBuffer buffer = new StringBuffer(); 174 StringBuffer buffer = new StringBuffer();
175 if (isNegative) buffer.add("-"); 175 if (isNegative) buffer.add("-");
176 for (int i = temp.length - 1; i >= 0; i--) { 176 for (int i = temp.length - 1; i >= 0; i--) {
177 buffer.add(table[temp[i]]); 177 buffer.add(table[temp[i]]);
178 } 178 }
179 return buffer.toString(); 179 return buffer.toString();
180 } 180 }
181 } 181 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 } 239 }
240 int _shlFromInt(int other) { 240 int _shlFromInt(int other) {
241 throw const OutOfMemoryError(); 241 throw const OutOfMemoryError();
242 } 242 }
243 243
244 int pow(int exponent) { 244 int pow(int exponent) {
245 throw "Bigint.pow not implemented"; 245 throw "Bigint.pow not implemented";
246 } 246 }
247 } 247 }
OLDNEW
« no previous file with comments | « runtime/lib/immutable_map.dart ('k') | runtime/lib/string_base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698