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

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

Issue 315173005: Add "last" setter to List. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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_array.dart
diff --git a/sdk/lib/_internal/lib/js_array.dart b/sdk/lib/_internal/lib/js_array.dart
index 42ee24859b918c2df43df42a0122ddb96e258772..e8f2906c4e4ccd8dddde831c3bbe4db5a88fb1af 100644
--- a/sdk/lib/_internal/lib/js_array.dart
+++ b/sdk/lib/_internal/lib/js_array.dart
@@ -364,6 +364,12 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
JS('void', r'#[#] = #', this, index, value);
}
+ void set last(E value) {
+ checkMutable('indexed set');
+ if (length == 0) throw IterableElementError.noElement();
+ JS('void', r'#[#] = #', this, this.length - 1, value);
+ }
+
Map<int, E> asMap() {
return IterableMixinWorkaround.asMapList(this);
}

Powered by Google App Engine
This is Rietveld 408576698