Index: dart/pkg/observe/lib/src/path_observer.dart |
=================================================================== |
--- dart/pkg/observe/lib/src/path_observer.dart (revision 37358) |
+++ dart/pkg/observe/lib/src/path_observer.dart (working copy) |
@@ -41,6 +41,7 @@ |
/// Sets the value at this path. |
void set value(Object newValue) { |
if (_path != null) _path.setValueFrom(_object, newValue); |
+ _discardChanges(); |
} |
int get _reportArgumentCount => 2; |
@@ -431,7 +432,7 @@ |
throw new StateError('Cannot add observers once started.'); |
} |
- observer.open(_deliver); |
+ observer.open((_) => deliver()); |
_observed..add(_observerSentinel)..add(observer); |
} |
@@ -532,10 +533,7 @@ |
return _value; |
} |
- get value { |
- _check(skipChanges: true); |
- return _value; |
- } |
+ get value => _discardChanges(); |
void close() { |
if (!_isOpen) return; |
@@ -545,10 +543,13 @@ |
_notifyCallback = null; |
} |
- void _deliver(_) { |
- if (_isOpen) _dirtyCheck(); |
+ _discardChanges() { |
+ _check(skipChanges: true); |
+ return _value; |
} |
+ bool deliver() => _isOpen ? _dirtyCheck() : false; |
+ |
bool _dirtyCheck() { |
var cycles = 0; |
while (cycles < _MAX_DIRTY_CHECK_CYCLES && _check()) { |