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

Unified Diff: runtime/lib/typed_data.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/typed_data.dart
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index b1845732b7df58203cae4084736826644c89f0e1..41c23bfc4dccde9f847e93e646c81cfbae638c33 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -409,6 +409,11 @@ abstract class _TypedListBase {
"Cannot resize a fixed-length list");
}
+ void set last(value) {
+ if (isEmpty) throw IterableElementError.noElement();
+ this[length - 1] = value;
+ }
+
void add(value) {
throw new UnsupportedError(
"Cannot add to a fixed-length list");

Powered by Google App Engine
This is Rietveld 408576698