Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions lib/change_detection/dirty_checking_change_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ class DirtyCheckingRecord<H> implements ChangeRecord<H>, WatchRecord<H> {
_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_) {
Expand All @@ -327,17 +330,19 @@ class DirtyCheckingRecord<H> implements ChangeRecord<H>, WatchRecord<H> {
} 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);
}
}

Expand Down Expand Up @@ -375,7 +380,7 @@ class DirtyCheckingRecord<H> implements ChangeRecord<H>, WatchRecord<H> {
// 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;
Expand All @@ -386,11 +391,11 @@ class DirtyCheckingRecord<H> implements ChangeRecord<H>, WatchRecord<H> {
}


remove() {
void remove() {
_group._recordRemove(this);
}

toString() => '${_MODE_NAMES[_mode]}[$field]';
String toString() => '${_MODE_NAMES[_mode]}[$field]';
}

final Object _INITIAL_ = new Object();
Expand Down Expand Up @@ -438,7 +443,7 @@ class _MapChangeRecord<K, V> implements MapChangeRecord<K, V> {
}


_check(Map map) {
bool _check(Map map) {
_reset();
_map = map;
Map records = _records;
Expand Down Expand Up @@ -705,18 +710,19 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
}
}


Iterable get iterable => _iterable;

_check(Iterable collection) {
bool _check(Iterable collection) {
_reset();
ItemRecord record = _collectionHead;
bool maybeDirty = false;
if ((collection is UnmodifiableListView) &&
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];
Expand All @@ -743,6 +749,7 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
index++;
}
}

_truncate(record);
_iterable = collection;
return isDirty;
Expand Down Expand Up @@ -1181,5 +1188,7 @@ class DuplicateMap {
return record;
}

void clear() => map.clear();
void clear() {
map.clear();
}
}
1 change: 1 addition & 0 deletions test/core_dom/http_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}