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

Commit

Permalink
perf(dccd): Drop useless checks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vicb committed Jul 31, 2014
1 parent 0b6a992 commit 209d14f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/change_detection/dirty_checking_change_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {

DirtyCheckingRecord _recordAdd(DirtyCheckingRecord record) {
DirtyCheckingRecord previous = _recordTail;
DirtyCheckingRecord next = previous == null ? null : previous._nextRecord;
DirtyCheckingRecord next = previous._nextRecord;

record._nextRecord = next;
record._prevRecord = previous;

if (previous != null) previous._nextRecord = record;
previous._nextRecord = record;
if (next != null) next._prevRecord = record;

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

if (record == _recordHead && record == _recordTail) {
if (_recordHead == _recordTail) {
assert(record == _recordHead);
// we are the last one, must leave marker behind.
_recordHead = _recordTail = _marker;
_marker._nextRecord = next;
Expand Down

0 comments on commit 209d14f

Please sign in to comment.