| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 : super(value); | 413 : super(value); |
| 414 | 414 |
| 415 accept(Visitor v) => v.visitMapLiteralEntry(this); | 415 accept(Visitor v) => v.visitMapLiteralEntry(this); |
| 416 } | 416 } |
| 417 | 417 |
| 418 class IdentifierObserver extends ExpressionObserver<Identifier> | 418 class IdentifierObserver extends ExpressionObserver<Identifier> |
| 419 implements Identifier { | 419 implements Identifier { |
| 420 | 420 |
| 421 IdentifierObserver(Identifier value) : super(value); | 421 IdentifierObserver(Identifier value) : super(value); |
| 422 | 422 |
| 423 String get value => (_expr as Identifier).value; | 423 String get value => _expr.value; |
| 424 | 424 |
| 425 _updateSelf(Scope scope) { | 425 _updateSelf(Scope scope) { |
| 426 _value = scope[value]; | 426 _value = scope[value]; |
| 427 | 427 |
| 428 var owner = scope.ownerOf(value); | 428 var owner = scope.ownerOf(value); |
| 429 if (owner is Observable) { | 429 if (owner is Observable) { |
| 430 var symbol = new Symbol(value); | 430 var symbol = new Symbol(value); |
| 431 _subscription = (owner as Observable).changes.listen((changes) { | 431 _subscription = (owner as Observable).changes.listen((changes) { |
| 432 if (changes.any( | 432 if (changes.any( |
| 433 (c) => c is PropertyChangeRecord && c.name == symbol)) { | 433 (c) => c is PropertyChangeRecord && c.name == symbol)) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 * This does not work for calls that need to pass more than one argument. | 645 * This does not work for calls that need to pass more than one argument. |
| 646 */ | 646 */ |
| 647 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; | 647 call(arg0) => mirror.invoke(symbol, [arg0], null).reflectee; |
| 648 } | 648 } |
| 649 | 649 |
| 650 class EvalException implements Exception { | 650 class EvalException implements Exception { |
| 651 final String message; | 651 final String message; |
| 652 EvalException(this.message); | 652 EvalException(this.message); |
| 653 String toString() => "EvalException: $message"; | 653 String toString() => "EvalException: $message"; |
| 654 } | 654 } |
| OLD | NEW |