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

Side by Side Diff: pkg/template_binding/lib/src/template_iterator.dart

Issue 213713002: Reapply change that makes path-observer more agressive with property lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/smoke/test/common.dart ('k') | pkg/template_binding/test/node_bind_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 part of template_binding; 5 part of template_binding;
6 6
7 // This code is a port of what was formerly known as Model-Driven-Views, now 7 // This code is a port of what was formerly known as Model-Driven-Views, now
8 // located at: 8 // located at:
9 // https://github.com/polymer/TemplateBinding 9 // https://github.com/polymer/TemplateBinding
10 // https://github.com/polymer/NodeBind 10 // https://github.com/polymer/NodeBind
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 var model = _iteratedValue[addIndex]; 424 var model = _iteratedValue[addIndex];
425 var fragment = null; 425 var fragment = null;
426 var instance = instanceCache.remove(model); 426 var instance = instanceCache.remove(model);
427 List instanceBindings; 427 List instanceBindings;
428 List instanceNodes = null; 428 List instanceNodes = null;
429 if (instance != null && instance.nodes.isNotEmpty) { 429 if (instance != null && instance.nodes.isNotEmpty) {
430 instanceBindings = instance.instanceBindings; 430 instanceBindings = instance.instanceBindings;
431 instanceNodes = instance.nodes; 431 instanceNodes = instance.nodes;
432 } else { 432 } else {
433 instanceBindings = []; 433 try {
434 if (_instanceModelFn != null) { 434 instanceBindings = [];
435 model = _instanceModelFn(model); 435 if (_instanceModelFn != null) {
436 } 436 model = _instanceModelFn(model);
437 if (model != null) { 437 }
438 fragment = _templateExt.createInstance(model, delegate, 438 if (model != null) {
439 instanceBindings); 439 fragment = _templateExt.createInstance(model, delegate,
440 instanceBindings);
441 }
442 } catch (e, s) {
443 // Dart note: we propagate errors asynchronously here to avoid
444 // disrupting the rendering flow. This is different than in the JS
445 // implementation but it should probably be fixed there too. Dart
446 // hits this case more because non-existing properties in
447 // [PropertyPath] are treated as errors, while JS treats them as
448 // null/undefined.
449 // TODO(sigmund): this should be a synchronous throw when this is
450 // called from createInstance, but that requires enough refactoring
451 // that it should be done upstream first. See dartbug.com/17789.
452 new Completer().completeError(e, s);
440 } 453 }
441 } 454 }
442 455
443 _insertInstanceAt(addIndex, fragment, instanceNodes, instanceBindings); 456 _insertInstanceAt(addIndex, fragment, instanceNodes, instanceBindings);
444 } 457 }
445 } 458 }
446 459
447 for (var instance in instanceCache.values) { 460 for (var instance in instanceCache.values) {
448 _closeInstanceBindings(instance.instanceBindings); 461 _closeInstanceBindings(instance.instanceBindings);
449 } 462 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 _closed = true; 533 _closed = true;
521 } 534 }
522 } 535 }
523 536
524 // Dart note: the JavaScript version just puts an expando on the array. 537 // Dart note: the JavaScript version just puts an expando on the array.
525 class _BoundNodes { 538 class _BoundNodes {
526 final List<Node> nodes; 539 final List<Node> nodes;
527 final List<Bindable> instanceBindings; 540 final List<Bindable> instanceBindings;
528 _BoundNodes(this.nodes, this.instanceBindings); 541 _BoundNodes(this.nodes, this.instanceBindings);
529 } 542 }
OLDNEW
« no previous file with comments | « pkg/smoke/test/common.dart ('k') | pkg/template_binding/test/node_bind_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698