| 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 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty], | 10 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty], |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 497 if (operator == '|' && left._value is ObservableList) { |
| 498 _subscription = left._value.listChanges.listen( | 498 _subscription = (left._value as ObservableList).listChanges |
| 499 (_) => _invalidate(scope)); | 499 .listen((_) => _invalidate(scope)); |
| 500 } | 500 } |
| 501 _value = f(left._value, right._value); | 501 _value = f(left._value, right._value); |
| 502 } | 502 } |
| 503 } | 503 } |
| 504 | 504 |
| 505 accept(Visitor v) => v.visitBinaryOperator(this); | 505 accept(Visitor v) => v.visitBinaryOperator(this); |
| 506 | 506 |
| 507 } | 507 } |
| 508 | 508 |
| 509 class InvokeObserver extends ExpressionObserver<Invoke> implements Invoke { | 509 class InvokeObserver extends ExpressionObserver<Invoke> implements Invoke { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 * 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. |
| 645 */ | 645 */ |
| 646 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; | 646 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; |
| 647 } | 647 } |
| 648 | 648 |
| 649 class EvalException implements Exception { | 649 class EvalException implements Exception { |
| 650 final String message; | 650 final String message; |
| 651 EvalException(this.message); | 651 EvalException(this.message); |
| 652 String toString() => "EvalException: $message"; | 652 String toString() => "EvalException: $message"; |
| 653 } | 653 } |
| OLD | NEW |