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

Side by Side Diff: samples-dev/swarm/swarm_ui_lib/observable/observable.dart

Issue 331833003: Revert "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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | sdk/lib/_internal/lib/js_array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library observable; 5 library observable;
6 6
7 part 'ChangeEvent.dart'; 7 part 'ChangeEvent.dart';
8 part 'EventBatch.dart'; 8 part 'EventBatch.dart';
9 9
10 /** 10 /**
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ObservableList([Observable parent = null]) 138 ObservableList([Observable parent = null])
139 : super(parent), _internal = new List<T>(); 139 : super(parent), _internal = new List<T>();
140 140
141 T operator [](int index) => _internal[index]; 141 T operator [](int index) => _internal[index];
142 142
143 void operator []=(int index, T value) { 143 void operator []=(int index, T value) {
144 recordListUpdate(index, value, _internal[index]); 144 recordListUpdate(index, value, _internal[index]);
145 _internal[index] = value; 145 _internal[index] = value;
146 } 146 }
147 147
148 void set last(T value) {
149 if (length == 0) throw new StateError("No element");
150 int index = length - 1;
151 recordListUpdate(index, value, _internal[index]);
152 _internal[index] = value;
153 }
154
155 int get length => _internal.length; 148 int get length => _internal.length;
156 149
157 void set length(int value) { 150 void set length(int value) {
158 _internal.length = value; 151 _internal.length = value;
159 recordGlobalChange(); 152 recordGlobalChange();
160 } 153 }
161 154
162 void clear() { 155 void clear() {
163 _internal.clear(); 156 _internal.clear();
164 recordGlobalChange(); 157 recordGlobalChange();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Only fire on an actual change. 354 // Only fire on an actual change.
362 if (!identical(newValue, _value)) { 355 if (!identical(newValue, _value)) {
363 final oldValue = _value; 356 final oldValue = _value;
364 _value = newValue; 357 _value = newValue;
365 recordPropertyUpdate("value", newValue, oldValue); 358 recordPropertyUpdate("value", newValue, oldValue);
366 } 359 }
367 } 360 }
368 361
369 T _value; 362 T _value;
370 } 363 }
OLDNEW
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | sdk/lib/_internal/lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698