Chromium Code Reviews| 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 is ListChangeRecord && c.indexChanged(key))) { | |
|
Jennifer Messerly
2014/05/29 02:38:11
type test isn't needed here... listChanges are onl
Siggi Cherem (dart-lang)
2014/05/29 03:11:33
nice :). done
| |
| 657 _invalidate(scope); | |
| 658 } | |
| 659 }); | |
| 660 } else if (receiverValue is Observable) { | |
| 654 _subscription = (receiverValue as Observable).changes.listen((changes) { | 661 _subscription = (receiverValue as Observable).changes.listen((changes) { |
| 655 if (changes.any((c) => c is MapChangeRecord && c.key == key)) { | 662 if (changes.any((c) => c is MapChangeRecord && c.key == key)) { |
| 656 _invalidate(scope); | 663 _invalidate(scope); |
| 657 } | 664 } |
| 658 }); | 665 }); |
| 659 } | 666 } |
| 660 } | 667 } |
| 661 | 668 |
| 662 accept(Visitor v) => v.visitIndex(this); | 669 accept(Visitor v) => v.visitIndex(this); |
| 663 } | 670 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 | 752 |
| 746 Comprehension(this.identifier, Iterable iterable) | 753 Comprehension(this.identifier, Iterable iterable) |
| 747 : iterable = (iterable != null) ? iterable : const []; | 754 : iterable = (iterable != null) ? iterable : const []; |
| 748 } | 755 } |
| 749 | 756 |
| 750 class EvalException implements Exception { | 757 class EvalException implements Exception { |
| 751 final String message; | 758 final String message; |
| 752 EvalException(this.message); | 759 EvalException(this.message); |
| 753 String toString() => "EvalException: $message"; | 760 String toString() => "EvalException: $message"; |
| 754 } | 761 } |
| OLD | NEW |