@@ -40,20 +40,20 @@ class ScopeEvent {
40
40
Scope _currentScope;
41
41
42
42
/**
43
- * true or false depending on if stopPropagation() was executed.
43
+ * true or false depending on if [ stopPropagation] was executed.
44
44
*/
45
45
bool get propagationStopped => _propagationStopped;
46
46
bool _propagationStopped = false ;
47
47
48
48
/**
49
- * true or false depending on if preventDefault() was executed.
49
+ * true or false depending on if [ preventDefault] was executed.
50
50
*/
51
51
bool get defaultPrevented => _defaultPrevented;
52
52
bool _defaultPrevented = false ;
53
53
54
54
/**
55
- ** [name] - The name of the scope event.
56
- ** [targetScope] - The destination scope that is listening on the event.
55
+ * [name] - The name of the scope event.
56
+ * [targetScope] - The destination scope that is listening on the event.
57
57
*/
58
58
ScopeEvent (this .name, this .targetScope, this .data);
59
59
@@ -157,11 +157,8 @@ class Scope {
157
157
*/
158
158
bool get isDestroyed {
159
159
var scope = this ;
160
- var root = rootScope;
161
160
while (scope != null ) {
162
- if (scope == root) {
163
- return false ;
164
- }
161
+ if (scope == rootScope) return false ;
165
162
scope = scope._parentScope;
166
163
}
167
164
return true ;
@@ -213,11 +210,7 @@ class Scope {
213
210
};
214
211
} else if (expression.startsWith (':' )) {
215
212
expression = expression.substring (1 );
216
- fn = (value, last) {
217
- if (value != null ) {
218
- return reactionFn (value, last);
219
- }
220
- };
213
+ fn = (value, last) => value == null ? null : reactionFn (value, last);
221
214
}
222
215
ast = rootScope._astParser (expression, context: context, filters: filters);
223
216
} else {
@@ -292,20 +285,18 @@ class Scope {
292
285
broadcast (ScopeEvent .DESTROY );
293
286
_Streams .destroy (this );
294
287
295
- var prev = _prev;
296
- var next = _next;
297
- if (prev == null ) {
298
- _parentScope._childHead = next;
288
+ if (_prev == null ) {
289
+ _parentScope._childHead = _next;
299
290
} else {
300
- prev ._next = next ;
291
+ _prev ._next = _next ;
301
292
}
302
- if (next == null ) {
303
- _parentScope._childTail = prev ;
293
+ if (_next == null ) {
294
+ _parentScope._childTail = _prev ;
304
295
} else {
305
- next ._prev = prev ;
296
+ _next ._prev = _prev ;
306
297
}
307
298
308
- this . _next = this . _prev = null ;
299
+ _next = _prev = null ;
309
300
310
301
_readWriteGroup.remove ();
311
302
_readOnlyGroup.remove ();
@@ -350,17 +341,8 @@ class Scope {
350
341
}
351
342
}
352
343
353
- _mapEqual (Map a, Map b) {
354
- if (a.length == b.length) {
355
- var equal = true ;
356
- a.forEach ((k, v) {
357
- equal = equal && b.containsKey (k) && v == b[k];
358
- });
359
- return equal;
360
- } else {
361
- return false ;
362
- }
363
- }
344
+ _mapEqual (Map a, Map b) => a.length == b.length &&
345
+ a.keys.every ((k) => b.containsKey (k) && a[k] == b[k]);
364
346
365
347
class RootScope extends Scope {
366
348
static final STATE_APPLY = 'apply' ;
0 commit comments