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

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

Issue 71353012: Make sure 'enumerate' changes when the underlying collection 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
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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 _updateSelf(Scope scope) { 488 _updateSelf(Scope scope) {
489 var f = _BINARY_OPERATORS[operator]; 489 var f = _BINARY_OPERATORS[operator];
490 if (operator == '&&' || operator == '||') { 490 if (operator == '&&' || operator == '||') {
491 _value = f(_toBool(left._value), _toBool(right._value)); 491 _value = f(_toBool(left._value), _toBool(right._value));
492 } else if (operator == '==' || operator == '!=') { 492 } else if (operator == '==' || operator == '!=') {
493 _value = f(left._value, right._value); 493 _value = f(left._value, right._value);
494 } else if (left._value == null || right._value == null) { 494 } else if (left._value == null || right._value == null) {
495 _value = null; 495 _value = null;
496 } else { 496 } else {
497 if (operator == '|' && left._value is ObservableList) {
498 _subscription = left._value.listChanges.listen(
499 (_) => _invalidate(scope));
500 }
497 _value = f(left._value, right._value); 501 _value = f(left._value, right._value);
498 } 502 }
499 } 503 }
500 504
501 accept(Visitor v) => v.visitBinaryOperator(this); 505 accept(Visitor v) => v.visitBinaryOperator(this);
502 506
503 } 507 }
504 508
505 class InvokeObserver extends ExpressionObserver<Invoke> implements Invoke { 509 class InvokeObserver extends ExpressionObserver<Invoke> implements Invoke {
506 final ExpressionObserver receiver; 510 final ExpressionObserver receiver;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 * This does not work for calls that need to pass more than one argument. 644 * This does not work for calls that need to pass more than one argument.
641 */ 645 */
642 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; 646 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee;
643 } 647 }
644 648
645 class EvalException implements Exception { 649 class EvalException implements Exception {
646 final String message; 650 final String message;
647 EvalException(this.message); 651 EvalException(this.message);
648 String toString() => "EvalException: $message"; 652 String toString() => "EvalException: $message";
649 } 653 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer_expressions/lib/src/globals.dart » ('j') | pkg/polymer_expressions/lib/src/globals.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698