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

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

Issue 310903003: Don’t throw on assignments to non-assignable expressions. Allow non-literal indices in assignable e… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months 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
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/eval_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 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
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
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 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/lib/eval.dart ('k') | pkg/polymer_expressions/test/eval_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698