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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/lib/src/template_iterator.dart
diff --git a/pkg/template_binding/lib/src/template_iterator.dart b/pkg/template_binding/lib/src/template_iterator.dart
index 66d44f5de32de4591f60dc7b845aa976adf699c1..24c1cacacd9c9b0432ae6bc991c05a014d9bd12e 100644
--- a/pkg/template_binding/lib/src/template_iterator.dart
+++ b/pkg/template_binding/lib/src/template_iterator.dart
@@ -430,13 +430,26 @@ class _TemplateIterator extends Bindable {
instanceBindings = instance.instanceBindings;
instanceNodes = instance.nodes;
} else {
- instanceBindings = [];
- if (_instanceModelFn != null) {
- model = _instanceModelFn(model);
- }
- if (model != null) {
- fragment = _templateExt.createInstance(model, delegate,
- instanceBindings);
+ try {
+ instanceBindings = [];
+ if (_instanceModelFn != null) {
+ model = _instanceModelFn(model);
+ }
+ if (model != null) {
+ fragment = _templateExt.createInstance(model, delegate,
+ instanceBindings);
+ }
+ } catch (e, s) {
+ // Dart note: we propagate errors asynchronously here to avoid
+ // disrupting the rendering flow. This is different than in the JS
+ // implementation but it should probably be fixed there too. Dart
+ // hits this case more because non-existing properties in
+ // [PropertyPath] are treated as errors, while JS treats them as
+ // null/undefined.
+ // TODO(sigmund): this should be a synchronous throw when this is
+ // called from createInstance, but that requires enough refactoring
+ // that it should be done upstream first. See dartbug.com/17789.
+ new Completer().completeError(e, s);
}
}
« 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