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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/interceptors.dart

Issue 11415028: Remove NullPointerException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart b/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
index 871ac31e12a3a844d0d8f2f92ca8ade2044b89fd..20d3bf1fb1156da4a060e6f1d567cb86ed2fd475 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
@@ -38,7 +38,6 @@ get$length(var receiver) {
set$length(receiver, newLength) {
if (isJsArray(receiver)) {
- checkNull(newLength); // TODO(ahe): This is not specified but co19 tests it.
if (newLength is !int) throw new ArgumentError(newLength);
if (newLength < 0) throw new RangeError.value(newLength);
checkGrowable(receiver, 'set length');
@@ -118,7 +117,6 @@ indexOf$1(receiver, element) {
var length = JS('num', r'#.length', receiver);
return Arrays.indexOf(receiver, element, 0, length);
} else if (receiver is String) {
- checkNull(element);
if (element is !String) throw new ArgumentError(element);
return JS('int', r'#.indexOf(#)', receiver, element);
}
@@ -131,7 +129,6 @@ indexOf$2(receiver, element, start) {
var length = JS('num', r'#.length', receiver);
return Arrays.indexOf(receiver, element, start, length);
} else if (receiver is String) {
- checkNull(element);
if (start is !int) throw new ArgumentError(start);
if (element is !String) throw new ArgumentError(element);
if (start < 0) return -1; // TODO(ahe): Is this correct?
@@ -173,7 +170,6 @@ lastIndexOf$1(receiver, element) {
var start = JS('num', r'#.length', receiver);
return Arrays.lastIndexOf(receiver, element, start);
} else if (receiver is String) {
- checkNull(element);
if (element is !String) throw new ArgumentError(element);
return JS('int', r'#.lastIndexOf(#)', receiver, element);
}
@@ -184,7 +180,6 @@ lastIndexOf$2(receiver, element, start) {
if (isJsArray(receiver)) {
return Arrays.lastIndexOf(receiver, element, start);
} else if (receiver is String) {
- checkNull(element);
if (element is !String) throw new ArgumentError(element);
if (start != null) {
if (start is !num) throw new ArgumentError(start);
@@ -207,8 +202,6 @@ removeRange(receiver, start, length) {
if (length == 0) {
return;
}
- checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
- checkNull(length); // TODO(ahe): This is not specified but co19 tests it.
if (start is !int) throw new ArgumentError(start);
if (length is !int) throw new ArgumentError(length);
if (length < 0) throw new ArgumentError(length);
@@ -241,10 +234,7 @@ setRange$4(receiver, start, length, from, startFrom) {
checkMutable(receiver, 'indexed set');
if (length == 0) return;
- checkNull(start); // TODO(ahe): This is not specified but co19 tests it.
- checkNull(length); // TODO(ahe): This is not specified but co19 tests it.
checkNull(from); // TODO(ahe): This is not specified but co19 tests it.
- checkNull(startFrom); // TODO(ahe): This is not specified but co19 tests it.
if (start is !int) throw new ArgumentError(start);
if (length is !int) throw new ArgumentError(length);
if (startFrom is !int) throw new ArgumentError(startFrom);
@@ -419,7 +409,7 @@ toRadixString(receiver, radix) {
contains$1(receiver, other) {
if (receiver is String) {
- return contains$2(receiver, other, 0);
+ return stringContainsUnchecked(receiver, other, 0);
} else if (isJsArray(receiver)) {
for (int i = 0; i < receiver.length; i++) {
if (other == receiver[i]) return true;

Powered by Google App Engine
This is Rietveld 408576698