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

Side by Side Diff: pkg/observe/lib/src/observable_list.dart

Issue 26734004: use symbol literals instead of const ctor in packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « pkg/observe/lib/src/observable_box.dart ('k') | pkg/observe/lib/src/observable_map.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of observe; 5 part of observe;
6 6
7 /** 7 /**
8 * Represents an observable list of model values. If any items are added, 8 * Represents an observable list of model values. If any items are added,
9 * removed, or replaced, then observers that are listening to [changes] 9 * removed, or replaced, then observers that are listening to [changes]
10 * will be notified. 10 * will be notified.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // list modifications. 218 // list modifications.
219 // One simple idea: we can simply update the index map as we do the operations 219 // One simple idea: we can simply update the index map as we do the operations
220 // to the list, then produce the records at the end. 220 // to the list, then produce the records at the end.
221 void _summarizeRecords() { 221 void _summarizeRecords() {
222 int oldLength = length; 222 int oldLength = length;
223 for (var r in _listRecords) { 223 for (var r in _listRecords) {
224 oldLength += r.removedCount - r.addedCount; 224 oldLength += r.removedCount - r.addedCount;
225 } 225 }
226 226
227 if (length != oldLength) { 227 if (length != oldLength) {
228 notifyPropertyChange(const Symbol('length'), oldLength, length); 228 notifyPropertyChange(#length, oldLength, length);
229 } 229 }
230 230
231 if (_listRecords.length == 1) { 231 if (_listRecords.length == 1) {
232 notifyChange(_listRecords[0]); 232 notifyChange(_listRecords[0]);
233 _listRecords = null; 233 _listRecords = null;
234 return; 234 return;
235 } 235 }
236 236
237 var items = []; 237 var items = [];
238 for (int i = 0; i < oldLength; i++) items.add(i); 238 for (int i = 0; i < oldLength; i++) items.add(i);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 if (added > 0 || removed > 0) { 272 if (added > 0 || removed > 0) {
273 notifyChange(new ListChangeRecord(startIndex, addedCount: added, 273 notifyChange(new ListChangeRecord(startIndex, addedCount: added,
274 removedCount: removed)); 274 removedCount: removed));
275 } 275 }
276 276
277 offset += removed - added; 277 offset += removed - added;
278 } 278 }
279 } 279 }
280 } 280 }
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/observable_box.dart ('k') | pkg/observe/lib/src/observable_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698