| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |