Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 209d14f

Browse files
committed
perf(dccd): Drop useless checks
in _recordAdd(), previous could never be null as the list is never empty (it has at least a marker). in _recordRemove(), when the list is composed of a single record, it must be the record we're trying to remove (and we assert that). Closes #1256
1 parent 0b6a992 commit 209d14f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/change_detection/dirty_checking_change_detector.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
175175

176176
DirtyCheckingRecord _recordAdd(DirtyCheckingRecord record) {
177177
DirtyCheckingRecord previous = _recordTail;
178-
DirtyCheckingRecord next = previous == null ? null : previous._nextRecord;
178+
DirtyCheckingRecord next = previous._nextRecord;
179179

180180
record._nextRecord = next;
181181
record._prevRecord = previous;
182182

183-
if (previous != null) previous._nextRecord = record;
183+
previous._nextRecord = record;
184184
if (next != null) next._prevRecord = record;
185185

186186
_recordTail = record;
@@ -194,7 +194,8 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
194194
DirtyCheckingRecord previous = record._prevRecord;
195195
DirtyCheckingRecord next = record._nextRecord;
196196

197-
if (record == _recordHead && record == _recordTail) {
197+
if (_recordHead == _recordTail) {
198+
assert(record == _recordHead);
198199
// we are the last one, must leave marker behind.
199200
_recordHead = _recordTail = _marker;
200201
_marker._nextRecord = next;

0 commit comments

Comments
 (0)