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

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

Issue 10911206: Remove support for operator negate and replace occurrences with unary (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « runtime/lib/double.dart ('k') | runtime/vm/parser.cc » ('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 const UnsupportedOperationException( 9 throw const UnsupportedOperationException(
10 "IntegerImplementation can only be allocated by the VM"); 10 "IntegerImplementation can only be allocated by the VM");
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 num operator /(num other) { 27 num operator /(num other) {
28 return this.toDouble() / other.toDouble(); 28 return this.toDouble() / other.toDouble();
29 } 29 }
30 num operator %(num other) { 30 num operator %(num other) {
31 if ((other is int) && (other == 0)) { 31 if ((other is int) && (other == 0)) {
32 throw const IntegerDivisionByZeroException(); 32 throw const IntegerDivisionByZeroException();
33 } 33 }
34 return other.moduloFromInteger(this); 34 return other.moduloFromInteger(this);
35 } 35 }
36 int operator negate() { 36 int operator -() {
37 return 0 - this; 37 return 0 - this;
38 } 38 }
39 int operator &(int other) { 39 int operator &(int other) {
40 return other.bitAndFromInteger(this); 40 return other.bitAndFromInteger(this);
41 } 41 }
42 int operator |(int other) { 42 int operator |(int other) {
43 return other.bitOrFromInteger(this); 43 return other.bitOrFromInteger(this);
44 } 44 }
45 int operator ^(int other) { 45 int operator ^(int other) {
46 return other.bitXorFromInteger(this); 46 return other.bitXorFromInteger(this);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 } 237 }
238 int shlFromInt(int other) { 238 int shlFromInt(int other) {
239 throw const OutOfMemoryException(); 239 throw const OutOfMemoryException();
240 } 240 }
241 241
242 int pow(int exponent) { 242 int pow(int exponent) {
243 throw "Bigint.pow not implemented"; 243 throw "Bigint.pow not implemented";
244 } 244 }
245 } 245 }
OLDNEW
« no previous file with comments | « runtime/lib/double.dart ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698