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: runtime/lib/growable_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: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 86791ef7caa44fab5a2794929b7990c0fc8066ef..23df7b6b65e0aa8faf34e79e297e0ba234021dd9 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -156,6 +156,11 @@ class _GrowableList<T> implements List<T> {
void operator []=(int index, T value) native "GrowableList_setIndexed";
+ void set last(T value) {
+ if (length == 0) throw IterableElementError.noElement();
+ this[length - 1] = value;
+ }
+
// The length of this growable array. It is always less than or equal to the
// length of the object array, which itself is always greater than 0, so that
// grow() does not have to check for a zero length object array before

Powered by Google App Engine
This is Rietveld 408576698