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

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: Added analyzer co19 expectations. 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 1f00319e21612daee86dabc0abb3b58b85188bdf..c07d16f48f2939e91c3d83417ff4a59f3316a519 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/interceptors.dart
@@ -74,7 +74,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');
@@ -200,8 +199,6 @@ getRange(receiver, start, length) {
return UNINTERCEPTED(receiver.getRange(start, length));
}
if (0 == length) 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);
@@ -220,7 +217,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);
}
@@ -233,7 +229,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?
@@ -268,7 +263,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);
}
@@ -279,7 +273,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);
@@ -302,8 +295,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);
@@ -336,10 +327,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);
@@ -514,7 +502,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