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

Unified Diff: pkg/template_binding/lib/src/template_iterator.dart

Issue 482763002: Revert "Roll polymer to 0.3.5" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/template_binding/lib/src/template.dart ('k') | pkg/template_binding/pubspec.yaml » ('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 71004867b9f16fbf768fb95412d475dfe0a52348..a2839eaaa0b10bf097e5b3e786634c268ba85e53 100644
--- a/pkg/template_binding/lib/src/template_iterator.dart
+++ b/pkg/template_binding/lib/src/template_iterator.dart
@@ -257,20 +257,18 @@ class _TemplateIterator extends Bindable {
_hasIf = directives._if != null;
_hasRepeat = directives._repeat != null;
- var ifValue = true;
if (_hasIf) {
_ifOneTime = directives._if.onlyOneTime;
_ifValue = _processBinding('if', directives._if, template, model);
- ifValue = _ifValue;
// oneTime if & predicate is false. nothing else to do.
- if (_ifOneTime && !_toBoolean(ifValue)) {
- _valueChanged(null);
- return;
- }
-
- if (!_ifOneTime) {
- ifValue = (ifValue as Bindable).open(_updateIfValue);
+ if (_ifOneTime) {
+ if (!_toBoolean(_ifValue)) {
+ _updateIteratedValue(null);
+ return;
+ }
+ } else {
+ (_ifValue as Bindable).open(_updateIteratedValue);
}
}
@@ -282,38 +280,12 @@ class _TemplateIterator extends Bindable {
_value = _processBinding('bind', directives._bind, template, model);
}
- var value = _value;
- if (!_oneTime) {
- value = _value.open(_updateIteratedValue);
- }
-
- if (!_toBoolean(ifValue)) {
- _valueChanged(null);
- return;
- }
-
- _updateValue(value);
- }
-
- /// Gets the updated value of the bind/repeat. This can potentially call
- /// user code (if a bindingDelegate is set up) so we try to avoid it if we
- /// already have the value in hand (from Observer.open).
- Object _getUpdatedValue() {
- var value = _value;
- // Dart note: x.discardChanges() is x.value in Dart.
- if (!_toBoolean(_oneTime)) value = value.value;
- return value;
- }
+ if (!_oneTime) _value.open(_updateIteratedValue);
- void _updateIfValue(ifValue) {
- if (!_toBoolean(ifValue)) {
- _valueChanged(null);
- return;
- }
- _updateValue(_getUpdatedValue());
+ _updateIteratedValue(null);
}
- void _updateIteratedValue(value) {
+ void _updateIteratedValue(_) {
if (_hasIf) {
var ifValue = _ifValue;
if (!_ifOneTime) ifValue = (ifValue as Bindable).value;
@@ -323,10 +295,8 @@ class _TemplateIterator extends Bindable {
}
}
- _updateValue(value);
- }
-
- void _updateValue(Object value) {
+ var value = _value;
+ if (!_oneTime) value = (value as Bindable).value;
if (!_hasRepeat) value = [value];
_valueChanged(value);
}
« no previous file with comments | « pkg/template_binding/lib/src/template.dart ('k') | pkg/template_binding/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698