diff --git a/lib/change_detection/dirty_checking_change_detector.dart b/lib/change_detection/dirty_checking_change_detector.dart index 24a568341..459f13b77 100644 --- a/lib/change_detection/dirty_checking_change_detector.dart +++ b/lib/change_detection/dirty_checking_change_detector.dart @@ -310,7 +310,10 @@ class DirtyCheckingRecord implements ChangeRecord, WatchRecord { _object = obj; if (obj == null) { _mode = _MODE_IDENTITY_; - } else if (field == null) { + return; + } + + if (field == null) { _instanceMirror = null; if (obj is Map) { if (_mode != _MODE_MAP_) { @@ -327,17 +330,19 @@ class DirtyCheckingRecord implements ChangeRecord, WatchRecord { } else { _mode = _MODE_IDENTITY_; } + + return; + } + + if (obj is Map) { + _mode = _MODE_MAP_FIELD_; + _instanceMirror = null; + } else if (_getter != null) { + _mode = _MODE_GETTER_; + _instanceMirror = null; } else { - if (obj is Map) { - _mode = _MODE_MAP_FIELD_; - _instanceMirror = null; - } else if (_getter != null) { - _mode = _MODE_GETTER_; - _instanceMirror = null; - } else { - _mode = _MODE_REFLECT_; - _instanceMirror = reflect(obj); - } + _mode = _MODE_REFLECT_; + _instanceMirror = reflect(obj); } } @@ -375,7 +380,7 @@ class DirtyCheckingRecord implements ChangeRecord, WatchRecord { // is the same. We save the value so that next time identity will pass currentValue = current; } else if (last is num && last.isNaN && current is num && current.isNaN) { - // we need this for JavaScript since in JS NaN !== NaN. + // we need this for the compiled JavaScript since in JS NaN !== NaN. } else { previousValue = last; currentValue = current; @@ -386,11 +391,11 @@ class DirtyCheckingRecord implements ChangeRecord, WatchRecord { } - remove() { + void remove() { _group._recordRemove(this); } - toString() => '${_MODE_NAMES[_mode]}[$field]'; + String toString() => '${_MODE_NAMES[_mode]}[$field]'; } final Object _INITIAL_ = new Object(); @@ -438,7 +443,7 @@ class _MapChangeRecord implements MapChangeRecord { } - _check(Map map) { + bool _check(Map map) { _reset(); _map = map; Map records = _records; @@ -705,10 +710,9 @@ class _CollectionChangeRecord implements CollectionChangeRecord { } } - Iterable get iterable => _iterable; - _check(Iterable collection) { + bool _check(Iterable collection) { _reset(); ItemRecord record = _collectionHead; bool maybeDirty = false; @@ -716,7 +720,9 @@ class _CollectionChangeRecord implements CollectionChangeRecord { identical(_iterable, collection)) { // Short circuit and assume that the list has not been modified. return false; - } else if (collection is List) { + } + + if (collection is List) { List list = collection; for(int index = 0; index < list.length; index++) { var item = list[index]; @@ -743,6 +749,7 @@ class _CollectionChangeRecord implements CollectionChangeRecord { index++; } } + _truncate(record); _iterable = collection; return isDirty; @@ -1181,5 +1188,7 @@ class DuplicateMap { return record; } - void clear() => map.clear(); + void clear() { + map.clear(); + } } diff --git a/test/core_dom/http_spec.dart b/test/core_dom/http_spec.dart index 4b198f46b..949e059c1 100644 --- a/test/core_dom/http_spec.dart +++ b/test/core_dom/http_spec.dart @@ -1327,4 +1327,5 @@ class FakeFile implements File { final int size = 0; final String type = null; Blob slice([int start, int end, String contentType]) => null; + int get lastModified => new DateTime.now().millisecondsSinceEpoch; }