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

Unified Diff: sdk/lib/_internal/lib/js_helper.dart

Issue 23440034: Make sure we throw the right NSM error when indexing out of range of a variable that can be null. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/lib/js_helper.dart
===================================================================
--- sdk/lib/_internal/lib/js_helper.dart (revision 27429)
+++ sdk/lib/_internal/lib/js_helper.dart (working copy)
@@ -776,9 +776,11 @@
* Called by generated code to throw an index-out-of-range exception,
* for example, if a bounds check fails in an optimized indexed
* access. This may also be called when the index is not an integer, in
- * which case it throws an illegal-argument exception instead, like [iae].
+ * which case it throws an illegal-argument exception instead, like
+ * [iae], or when the receiver is null.
*/
-ioore(index) {
+ioore(receiver, index) {
+ if (receiver == null) receiver.length; // Force a NoSuchMethodError.
if (index is !int) iae(index);
throw new RangeError.value(index);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | tests/language/inference_list_or_null_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698