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

Side by Side Diff: pkg/polymer_expressions/lib/eval.dart

Issue 53743002: introduce ObservableList.listChanges to keep list changes separate from property changes (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/polymer/lib/src/instance.dart ('k') | pkg/template_binding/lib/src/list_diff.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 library polymer_expressions.eval; 5 library polymer_expressions.eval;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty], 10 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty],
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 _updateSelf(Scope scope) { 583 _updateSelf(Scope scope) {
584 Identifier identifier = left; 584 Identifier identifier = left;
585 var iterable = right._value; 585 var iterable = right._value;
586 586
587 if (iterable is! Iterable && iterable != null) { 587 if (iterable is! Iterable && iterable != null) {
588 throw new EvalException("right side of 'in' is not an iterator"); 588 throw new EvalException("right side of 'in' is not an iterator");
589 } 589 }
590 590
591 if (iterable is ObservableList) { 591 if (iterable is ObservableList) {
592 _subscription = (iterable as ObservableList).changes.listen( 592 _subscription = iterable.listChanges.listen((_) => _invalidate(scope));
593 (List<ChangeRecord> changes) {
594 if (changes.any((c) => c is ListChangeRecord)) {
595 _invalidate(scope);
596 }
597 });
598 } 593 }
599 594
600 // TODO: make Comprehension observable and update it 595 // TODO: make Comprehension observable and update it
601 _value = new Comprehension(identifier.value, iterable); 596 _value = new Comprehension(identifier.value, iterable);
602 } 597 }
603 598
604 accept(Visitor v) => v.visitInExpression(this); 599 accept(Visitor v) => v.visitInExpression(this);
605 } 600 }
606 601
607 _toBool(v) => (v == null) ? false : v; 602 _toBool(v) => (v == null) ? false : v;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 * This does not work for calls that need to pass more than one argument. 640 * This does not work for calls that need to pass more than one argument.
646 */ 641 */
647 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; 642 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee;
648 } 643 }
649 644
650 class EvalException implements Exception { 645 class EvalException implements Exception {
651 final String message; 646 final String message;
652 EvalException(this.message); 647 EvalException(this.message);
653 String toString() => "EvalException: $message"; 648 String toString() => "EvalException: $message";
654 } 649 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/instance.dart ('k') | pkg/template_binding/lib/src/list_diff.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698