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

Commit 2c47952

Browse files
vicbmhevery
authored andcommitted
style: cleanup
1 parent 96c1a49 commit 2c47952

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+501
-591
lines changed

lib/animate/animation_optimizer.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AnimationOptimizer {
6464
* [mode] "auto" will detect if a parent animation is running or has child animations set.
6565
*/
6666
void alwaysAnimate(dom.Element element, String mode) {
67-
if(mode == "always") {
67+
if (mode == "always") {
6868
_alwaysAnimate[element] = true;
6969
} else if (mode == "never") {
7070
_alwaysAnimate[element] = false;
@@ -80,7 +80,7 @@ class AnimationOptimizer {
8080
* [mode] "auto" will detect if a parent animation is running or has child animations set.
8181
*/
8282
void alwaysAnimateChildren(dom.Element element, String mode) {
83-
if(mode == "always") {
83+
if (mode == "always") {
8484
_alwaysAnimateChildren[element] = true;
8585
} else if (mode == "never") {
8686
_alwaysAnimateChildren[element] = false;
@@ -116,7 +116,7 @@ class AnimationOptimizer {
116116
while (node != null) {
117117
// Does this node give us animation information about our children?
118118
alwaysAnimate = _alwaysAnimateChildren[node];
119-
if(alwaysAnimate != null) {
119+
if (alwaysAnimate != null) {
120120
return alwaysAnimate;
121121
}
122122

@@ -129,9 +129,9 @@ class AnimationOptimizer {
129129
// If there is an already running animation, don't animate.
130130
autoDecision = false;
131131
}
132-
132+
133133
// If we hit a null parent, try to break out of shadow dom.
134-
if(node.parentNode == null) {
134+
if (node.parentNode == null) {
135135
var probe = _findElementProbe(node);
136136
if (probe != null && probe.parent != null) {
137137
// Escape shadow dom!
@@ -148,7 +148,7 @@ class AnimationOptimizer {
148148

149149
return autoDecision;
150150
}
151-
151+
152152
// Search and find the element probe for a given node.
153153
ElementProbe _findElementProbe(dom.Node node) {
154154
while (node != null) {

lib/change_detection/ast.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ class PureFunctionAST extends AST {
7979
final List<AST> argsAST;
8080

8181
PureFunctionAST(name, this.fn, argsAST)
82-
: super('$name(${_argList(argsAST)})'),
83-
argsAST = argsAST,
84-
name = name;
82+
: argsAST = argsAST,
83+
name = name,
84+
super('$name(${_argList(argsAST)})');
8585

8686
WatchRecord<_Handler> setupWatch(WatchGroup watchGroup) =>
8787
watchGroup.addFunctionWatch(fn, argsAST, expression);
@@ -98,10 +98,10 @@ class MethodAST extends AST {
9898
final List<AST> argsAST;
9999

100100
MethodAST(lhsAST, name, argsAST)
101-
: super('$lhsAST.$name(${_argList(argsAST)})'),
102-
lhsAST = lhsAST,
101+
: lhsAST = lhsAST,
103102
name = name,
104-
argsAST = argsAST;
103+
argsAST = argsAST,
104+
super('$lhsAST.$name(${_argList(argsAST)})');
105105

106106
WatchRecord<_Handler> setupWatch(WatchGroup watchGroup) =>
107107
watchGroup.addMethodWatch(lhsAST, name, argsAST, expression);

lib/change_detection/dirty_checking_change_detector.dart

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
7272
DirtyCheckingChangeDetector get _root {
7373
var root = this;
7474
var next;
75-
while((next = root._parent) != null) {
75+
while ((next = root._parent) != null) {
7676
root = next;
7777
}
7878
return root is DirtyCheckingChangeDetector ? root : null;
@@ -104,7 +104,7 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
104104
int count = 0;
105105
DirtyCheckingRecord cursor = _recordHead;
106106
DirtyCheckingRecord end = _childInclRecordTail;
107-
while(cursor != null) {
107+
while (cursor != null) {
108108
if (cursor._mode != DirtyCheckingRecord._MODE_MARKER_) {
109109
count++;
110110
}
@@ -152,7 +152,7 @@ class DirtyCheckingChangeDetectorGroup<H> implements ChangeDetectorGroup<H> {
152152
if (nextRecord != null) nextRecord._prevRecord = prevRecord;
153153

154154
var cursor = _recordHead;
155-
while(cursor != nextRecord) {
155+
while (cursor != nextRecord) {
156156
cursor = cursor._nextRecord;
157157
}
158158

@@ -258,16 +258,16 @@ class DirtyCheckingChangeDetector<H> extends DirtyCheckingChangeDetectorGroup<H>
258258
var record = this._recordHead;
259259
var groups = [this];
260260
DirtyCheckingChangeDetectorGroup group;
261-
while(groups.isNotEmpty) {
261+
while (groups.isNotEmpty) {
262262
group = groups.removeAt(0);
263263
DirtyCheckingChangeDetectorGroup childGroup = group._childTail;
264-
while(childGroup != null) {
264+
while (childGroup != null) {
265265
groups.insert(0, childGroup);
266266
childGroup = childGroup._prev;
267267
}
268268
var groupRecord = group._recordHead;
269269
var groupLast = group._recordTail;
270-
while(true) {
270+
while (true) {
271271
if (groupRecord == record) {
272272
record = record._nextRecord;
273273
} else {
@@ -510,23 +510,23 @@ class _MapChangeRecord<K, V> implements MapChangeRecord<K, V> {
510510

511511
void forEachChange(void f(ChangedKeyValue<K, V> change)) {
512512
KeyValueRecord record = _changesHead;
513-
while(record != null) {
513+
while (record != null) {
514514
f(record);
515515
record = record._nextChangedKeyValue;
516516
}
517517
}
518518

519519
void forEachAddition(void f(AddedKeyValue<K, V> addition)){
520520
KeyValueRecord record = _additionsHead;
521-
while(record != null) {
521+
while (record != null) {
522522
f(record);
523523
record = record._nextAddedKeyValue;
524524
}
525525
}
526526

527527
void forEachRemoval(void f(RemovedKeyValue<K, V> removal)){
528528
KeyValueRecord record = _removalsHead;
529-
while(record != null) {
529+
while (record != null) {
530530
f(record);
531531
record = record._nextRemovedKeyValue;
532532
}
@@ -631,7 +631,7 @@ class _MapChangeRecord<K, V> implements MapChangeRecord<K, V> {
631631
}
632632

633633
void _truncate(KeyValueRecord lastRecord, KeyValueRecord record) {
634-
while(record != null) {
634+
while (record != null) {
635635
if (lastRecord == null) {
636636
_mapHead = null;
637637
} else {
@@ -782,23 +782,23 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
782782

783783
void forEachAddition(void f(AddedItem<V> addition)){
784784
ItemRecord record = _additionsHead;
785-
while(record != null) {
785+
while (record != null) {
786786
f(record);
787787
record = record._nextAddedRec;
788788
}
789789
}
790790

791791
void forEachMove(void f(MovedItem<V> change)) {
792792
ItemRecord record = _movesHead;
793-
while(record != null) {
793+
while (record != null) {
794794
f(record);
795795
record = record._nextMovedRec;
796796
}
797797
}
798798

799799
void forEachRemoval(void f(RemovedItem<V> removal)){
800800
ItemRecord record = _removalsHead;
801-
while(record != null) {
801+
while (record != null) {
802802
f(record);
803803
record = record._nextRemovedRec;
804804
}
@@ -858,14 +858,14 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
858858
ItemRecord record;
859859

860860
record = _additionsHead;
861-
while(record != null) {
861+
while (record != null) {
862862
record.previousIndex = record.currentIndex;
863863
record = record._nextAddedRec;
864864
}
865865
_additionsHead = _additionsTail = null;
866866

867867
record = _movesHead;
868-
while(record != null) {
868+
while (record != null) {
869869
record.previousIndex = record.currentIndex;
870870
var nextRecord = record._nextMovedRec;
871871
assert((record._nextMovedRec = null) == null);
@@ -978,7 +978,7 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
978978
*/
979979
void _truncate(ItemRecord record) {
980980
// Anything after that needs to be removed;
981-
while(record != null) {
981+
while (record != null) {
982982
ItemRecord nextRecord = record._nextRec;
983983
_removals_add(_collection_unlink(record));
984984
record = nextRecord;
@@ -1134,28 +1134,28 @@ class _CollectionChangeRecord<V> implements CollectionChangeRecord<V> {
11341134

11351135
var list = [];
11361136
record = _collectionHead;
1137-
while(record != null) {
1137+
while (record != null) {
11381138
list.add(record);
11391139
record = record._nextRec;
11401140
}
11411141

11421142
var additions = [];
11431143
record = _additionsHead;
1144-
while(record != null) {
1144+
while (record != null) {
11451145
additions.add(record);
11461146
record = record._nextAddedRec;
11471147
}
11481148

11491149
var moves = [];
11501150
record = _movesHead;
1151-
while(record != null) {
1151+
while (record != null) {
11521152
moves.add(record);
11531153
record = record._nextMovedRec;
11541154
}
11551155

11561156
var removals = [];
11571157
record = _removalsHead;
1158-
while(record != null) {
1158+
while (record != null) {
11591159
removals.add(record);
11601160
record = record._nextRemovedRec;
11611161
}
@@ -1225,7 +1225,7 @@ class _DuplicateItemRecordList {
12251225

12261226
ItemRecord get(key, int hideIndex) {
12271227
ItemRecord record = head;
1228-
while(record != null) {
1228+
while (record != null) {
12291229
if (hideIndex == null ||
12301230
hideIndex < record.currentIndex && identical(record.item, key)) {
12311231
return record;
@@ -1239,7 +1239,7 @@ class _DuplicateItemRecordList {
12391239
assert(() {
12401240
// verify that the record being removed is someplace in the list.
12411241
ItemRecord cursor = head;
1242-
while(cursor != null) {
1242+
while (cursor != null) {
12431243
if (identical(cursor, record)) return true;
12441244
cursor = cursor._nextDupRec;
12451245
}

lib/change_detection/watch_group.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
5656
int get totalFieldCost {
5757
var cost = _fieldCost;
5858
WatchGroup group = _watchGroupHead;
59-
while(group != null) {
59+
while (group != null) {
6060
cost += group.totalFieldCost;
6161
group = group._nextWatchGroup;
6262
}
@@ -68,7 +68,7 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
6868
int get totalCollectionCost {
6969
var cost = _collectionCost;
7070
WatchGroup group = _watchGroupHead;
71-
while(group != null) {
71+
while (group != null) {
7272
cost += group.totalCollectionCost;
7373
group = group._nextWatchGroup;
7474
}
@@ -82,7 +82,7 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
8282
int get totalEvalCost {
8383
var cost = _evalCost;
8484
WatchGroup group = _watchGroupHead;
85-
while(group != null) {
85+
while (group != null) {
8686
cost += group.evalCost;
8787
group = group._nextWatchGroup;
8888
}
@@ -118,7 +118,7 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
118118
get isAttached {
119119
var group = this;
120120
var root = _rootGroup;
121-
while(group != null) {
121+
while (group != null) {
122122
if (group == root){
123123
return true;
124124
}
@@ -219,14 +219,14 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
219219

220220
// Convert the args from AST to WatchRecords
221221
var i = 0;
222-
argsAST.
223-
map((ast) => _cache.putIfAbsent(ast.expression,
224-
() => ast.setupWatch(this))).forEach((WatchRecord<_Handler> record) {
225-
var argHandler = new _ArgHandler(this, evalWatchRecord, i++);
226-
_ArgHandlerList._add(invokeHandler, argHandler);
227-
record.handler.addForwardHandler(argHandler);
228-
argHandler.acceptValue(record.currentValue);
229-
});
222+
argsAST.map((ast) =>
223+
_cache.putIfAbsent(ast.expression, () => ast.setupWatch(this)))
224+
.forEach((WatchRecord<_Handler> record) {
225+
var argHandler = new _ArgHandler(this, evalWatchRecord, i++);
226+
_ArgHandlerList._add(invokeHandler, argHandler);
227+
record.handler.addForwardHandler(argHandler);
228+
argHandler.acceptValue(record.currentValue);
229+
});
230230

231231
// Must be done last
232232
_EvalWatchList._add(this, evalWatchRecord);
@@ -414,7 +414,7 @@ class RootWatchGroup extends WatchGroup {
414414
_dirtyWatchHead = null;
415415
RootWatchGroup root = _rootGroup;
416416
try {
417-
while(dirtyWatch != null) {
417+
while (dirtyWatch != null) {
418418
count++;
419419
try {
420420
if (root._removeCount == 0 || dirtyWatch._watchGroup.isAttached) {
@@ -563,7 +563,7 @@ abstract class _Handler implements _LinkedList, _LinkedListItem, _WatchList {
563563
// If we have reaction functions than queue them up for asynchronous
564564
// processing.
565565
Watch watch = _watchHead;
566-
while(watch != null) {
566+
while (watch != null) {
567567
watchGrp._rootGroup._addDirtyWatch(watch);
568568
watch = watch._nextWatch;
569569
}
@@ -655,7 +655,7 @@ class _InvokeHandler extends _Handler implements _ArgHandlerList {
655655
void release() {
656656
super.release();
657657
_ArgHandler current = _argHandlerHead;
658-
while(current != null) {
658+
while (current != null) {
659659
current.release();
660660
current = current._nextArgHandler;
661661
}

lib/core/cache.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class UnboundedCache<K, V> implements Cache<K, V> {
7676
* - should stringify keys?
7777
*/
7878
class LruCache<K, V> extends Cache<K, V> {
79-
Map<K, V> _entries = new LinkedHashMap<K, V>();
79+
final _entries = new LinkedHashMap<K, V>();
8080
int _capacity;
8181
int _hits = 0;
8282
int _misses = 0;

0 commit comments

Comments
 (0)