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

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

Issue 308563002: Fix polymer_expression binding bug with observable 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 | « no previous file | pkg/polymer_expressions/pubspec.yaml » ('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 import 'package:observe/observe.dart'; 10 import 'package:observe/observe.dart';
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 643
644 _updateSelf(Scope scope) { 644 _updateSelf(Scope scope) {
645 var receiverValue = receiver._value; 645 var receiverValue = receiver._value;
646 if (receiverValue == null) { 646 if (receiverValue == null) {
647 _value = null; 647 _value = null;
648 return; 648 return;
649 } 649 }
650 var key = argument._value; 650 var key = argument._value;
651 _value = receiverValue[key]; 651 _value = receiverValue[key];
652 652
653 if (receiverValue is Observable) { 653 if (receiverValue is ObservableList) {
654 _subscription = (receiverValue as ObservableList).listChanges
655 .listen((changes) {
656 if (changes.any((c) => c.indexChanged(key))) _invalidate(scope);
657 });
658 } else if (receiverValue is Observable) {
654 _subscription = (receiverValue as Observable).changes.listen((changes) { 659 _subscription = (receiverValue as Observable).changes.listen((changes) {
655 if (changes.any((c) => c is MapChangeRecord && c.key == key)) { 660 if (changes.any((c) => c is MapChangeRecord && c.key == key)) {
656 _invalidate(scope); 661 _invalidate(scope);
657 } 662 }
658 }); 663 });
659 } 664 }
660 } 665 }
661 666
662 accept(Visitor v) => v.visitIndex(this); 667 accept(Visitor v) => v.visitIndex(this);
663 } 668 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 750
746 Comprehension(this.identifier, Iterable iterable) 751 Comprehension(this.identifier, Iterable iterable)
747 : iterable = (iterable != null) ? iterable : const []; 752 : iterable = (iterable != null) ? iterable : const [];
748 } 753 }
749 754
750 class EvalException implements Exception { 755 class EvalException implements Exception {
751 final String message; 756 final String message;
752 EvalException(this.message); 757 EvalException(this.message);
753 String toString() => "EvalException: $message"; 758 String toString() => "EvalException: $message";
754 } 759 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer_expressions/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698