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

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

Issue 11861007: Move indexSet and unary operators to the new interceptor mechanism. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/compiler/implementation/lib/js_array.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/js_array.dart (revision 17016)
+++ sdk/lib/_internal/compiler/implementation/lib/js_array.dart (working copy)
@@ -172,7 +172,7 @@
}
void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
- checkMutable(this, 'indexed set');
+ checkMutable(this, 'set range');
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.
@@ -248,6 +248,13 @@
if (index >= length || index < 0) throw new RangeError.value(index);
return JS('var', '#[#]', this, index);
}
+
+ void operator []=(int index, E value) {
+ checkMutable(this, 'indexed set');
+ if (index is !int) throw new ArgumentError(index);
+ if (index >= length || index < 0) throw new RangeError.value(index);
+ JS('void', r'#[#] = #', this, index, value);
+ }
}
/** Iterator for JavaScript Arrays. */

Powered by Google App Engine
This is Rietveld 408576698