| 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 /** | 5 /** |
| 6 * A binding delegate used with Polymer elements that | 6 * A binding delegate used with Polymer elements that |
| 7 * allows for complex binding expressions, including | 7 * allows for complex binding expressions, including |
| 8 * property access, function invocation, | 8 * property access, function invocation, |
| 9 * list/map indexing, and two-way filtering. | 9 * list/map indexing, and two-way filtering. |
| 10 * | 10 * |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 get value { | 293 get value { |
| 294 // if there's a callback, then _value has been set, if not we need to | 294 // if there's a callback, then _value has been set, if not we need to |
| 295 // force an evaluation | 295 // force an evaluation |
| 296 if (_callback != null) return _value; | 296 if (_callback != null) return _value; |
| 297 return _oneTime(_expr, _scope, _converter); | 297 return _oneTime(_expr, _scope, _converter); |
| 298 } | 298 } |
| 299 | 299 |
| 300 set value(v) { | 300 set value(v) { |
| 301 try { | 301 try { |
| 302 var newValue = assign(_expr, v, _scope); | 302 var newValue = assign(_expr, v, _scope, checkAssignability: false); |
| 303 _check(newValue, skipChanges: true); | 303 _check(newValue, skipChanges: true); |
| 304 } catch (e, s) { | 304 } catch (e, s) { |
| 305 new Completer().completeError( | 305 new Completer().completeError( |
| 306 "Error evaluating expression '$_expr': $e", s); | 306 "Error evaluating expression '$_expr': $e", s); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 Object open(callback(value)) { | 310 Object open(callback(value)) { |
| 311 if (_callback != null) throw new StateError('already open'); | 311 if (_callback != null) throw new StateError('already open'); |
| 312 | 312 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 343 * Factory function used for testing. | 343 * Factory function used for testing. |
| 344 */ | 344 */ |
| 345 class ScopeFactory { | 345 class ScopeFactory { |
| 346 const ScopeFactory(); | 346 const ScopeFactory(); |
| 347 modelScope({Object model, Map<String, Object> variables}) => | 347 modelScope({Object model, Map<String, Object> variables}) => |
| 348 new Scope(model: model, variables: variables); | 348 new Scope(model: model, variables: variables); |
| 349 | 349 |
| 350 childScope(Scope parent, String name, Object value) => | 350 childScope(Scope parent, String name, Object value) => |
| 351 parent.childScope(name, value); | 351 parent.childScope(name, value); |
| 352 } | 352 } |
| OLD | NEW |