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

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

Issue 51483002: fix PathObserver to avoid try+catch (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/compound_binding.dart ('k') | pkg/observe/lib/src/metadata.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 library observe.src.list_path_observer;
6
7 import 'dart:async';
8 import 'package:observe/observe.dart';
6 9
7 // Inspired by ArrayReduction at: 10 // Inspired by ArrayReduction at:
8 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js 11 // https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js
9 // The main difference is we support anything on the rich Dart Iterable API. 12 // The main difference is we support anything on the rich Dart Iterable API.
10 13
11 /** 14 /**
12 * Observes a path starting from each item in the list. 15 * Observes a path starting from each item in the list.
13 */ 16 */
14 class ListPathObserver<E, P> extends ChangeNotifier { 17 class ListPathObserver<E, P> extends ChangeNotifier {
15 final ObservableList<E> list; 18 final ObservableList<E> list;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 69 }
67 } else if (lengthAdjust < 0) { 70 } else if (lengthAdjust < 0) {
68 for (int i = 0; i < -lengthAdjust; i++) { 71 for (int i = 0; i < -lengthAdjust; i++) {
69 _subs.removeLast().cancel(); 72 _subs.removeLast().cancel();
70 } 73 }
71 int len = _observers.length; 74 int len = _observers.length;
72 _observers.removeRange(len + lengthAdjust, len); 75 _observers.removeRange(len + lengthAdjust, len);
73 } 76 }
74 } 77 }
75 } 78 }
OLDNEW
« no previous file with comments | « pkg/observe/lib/src/compound_binding.dart ('k') | pkg/observe/lib/src/metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698