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

Unified Diff: runtime/lib/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/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index dd3e03fc33fb934e6eb2a3cc9b93eb0ddf503675..5494f6b1f79515dcaa52a8130b6ad54d2ceb061a 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -243,6 +243,11 @@ class _List<E> implements List<E> {
throw IterableElementError.noElement();
}
+ void set last(E value) {
+ if (length == 0) throw IterableElementError.noElement();
+ this[length - 1] = value;
+ }
+
E get single {
if (length == 1) return this[0];
if (length == 0) throw IterableElementError.noElement();
@@ -287,6 +292,10 @@ class _ImmutableList<E> implements List<E> {
throw UnmodifiableListError.change();
}
+ void set last(E value) {
+ throw UnmodifiableListError.change();
+ }
+
int get length native "List_getLength";
void insert(int index, E element) {

Powered by Google App Engine
This is Rietveld 408576698