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

Side by Side Diff: lib/compiler/implementation/lib/math_patch.dart

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 2 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 // Patch file for dart:math library. 5 // Patch file for dart:math library.
6 6
7 // Imports checkNum etc. used below. 7 // Imports checkNum etc. used below.
8 #import("js_helper.dart"); 8 #import("js_helper.dart");
9 9
10 patch double sqrt(num x) 10 patch double sqrt(num x)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 patch class Random { 46 patch class Random {
47 patch factory Random([int seed]) => const _Random(); 47 patch factory Random([int seed]) => const _Random();
48 } 48 }
49 49
50 class _Random implements Random { 50 class _Random implements Random {
51 // The Dart2JS implementation of Random doesn't use a seed. 51 // The Dart2JS implementation of Random doesn't use a seed.
52 const _Random(); 52 const _Random();
53 53
54 int nextInt(int max) { 54 int nextInt(int max) {
55 if (max < 0) throw new IllegalArgumentException("negative max: $max"); 55 if (max < 0) throw new ArgumentError("negative max: $max");
56 if (max > 0xFFFFFFFF) max = 0xFFFFFFFF; 56 if (max > 0xFFFFFFFF) max = 0xFFFFFFFF;
57 return JS("int", "(Math.random() * #) >>> 0", max); 57 return JS("int", "(Math.random() * #) >>> 0", max);
58 } 58 }
59 59
60 /** 60 /**
61 * Generates a positive random floating point value uniformly distributed on 61 * Generates a positive random floating point value uniformly distributed on
62 * the range from 0.0, inclusive, to 1.0, exclusive. 62 * the range from 0.0, inclusive, to 1.0, exclusive.
63 */ 63 */
64 double nextDouble() => JS("double", "Math.random()"); 64 double nextDouble() => JS("double", "Math.random()");
65 65
66 /** 66 /**
67 * Generates a random boolean value. 67 * Generates a random boolean value.
68 */ 68 */
69 bool nextBool() => JS("bool", "Math.random() < 0.5"); 69 bool nextBool() => JS("bool", "Math.random() < 0.5");
70 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698