@@ -77,7 +77,7 @@ class ElementBinder {
77
77
78
78
void _bindTwoWay (tasks, AST ast, scope, directiveScope,
79
79
controller, AST dstAST) {
80
- var taskId = tasks.registerTask ();
80
+ var taskId = ( tasks != null ) ? tasks .registerTask () : 0 ;
81
81
82
82
var viewOutbound = false ;
83
83
var viewInbound = false ;
@@ -86,7 +86,7 @@ class ElementBinder {
86
86
viewOutbound = true ;
87
87
scope.rootScope.runAsync (() => viewOutbound = false );
88
88
var value = dstAST.parsedExp.assign (controller, inboundValue);
89
- tasks.completeTask (taskId);
89
+ if (tasks != null ) tasks.completeTask (taskId);
90
90
return value;
91
91
}
92
92
});
@@ -96,18 +96,18 @@ class ElementBinder {
96
96
viewInbound = true ;
97
97
scope.rootScope.runAsync (() => viewInbound = false );
98
98
ast.parsedExp.assign (scope.context, outboundValue);
99
- tasks.completeTask (taskId);
99
+ if (tasks != null ) tasks.completeTask (taskId);
100
100
}
101
101
});
102
102
}
103
103
}
104
104
105
105
_bindOneWay (tasks, ast, scope, AST dstAST, controller) {
106
- var taskId = tasks.registerTask ();
106
+ var taskId = ( tasks != null ) ? tasks .registerTask () : 0 ;
107
107
108
108
scope.watchAST (ast, (v, _) {
109
109
dstAST.parsedExp.assign (controller, v);
110
- tasks.completeTask (taskId);
110
+ if (tasks != null ) tasks.completeTask (taskId);
111
111
});
112
112
}
113
113
@@ -148,10 +148,10 @@ class ElementBinder {
148
148
149
149
switch (p.mode) {
150
150
case '@' : // string
151
- var taskId = tasks.registerTask ();
151
+ var taskId = ( tasks != null ) ? tasks .registerTask () : 0 ;
152
152
nodeAttrs.observe (attrName, (value) {
153
153
dstAST.parsedExp.assign (directive, value);
154
- tasks.completeTask (taskId);
154
+ if (tasks != null ) tasks.completeTask (taskId);
155
155
});
156
156
break ;
157
157
@@ -207,26 +207,26 @@ class ElementBinder {
207
207
scope.context[(ref.annotation as Controller ).publishAs] = directive;
208
208
}
209
209
210
- var tasks = new _TaskList ( directive is AttachAware ? () {
210
+ var tasks = directive is AttachAware ? new _TaskList ( () {
211
211
if (scope.isAttached) directive.attach ();
212
- } : null ) ;
212
+ }) : null ;
213
213
214
214
if (ref.mappings.isNotEmpty) {
215
215
if (nodeAttrs == null ) nodeAttrs = new _AnchorAttrs (ref);
216
216
_createAttrMappings (directive, scope, ref.mappings, nodeAttrs, tasks);
217
217
}
218
218
219
219
if (directive is AttachAware ) {
220
- var taskId = tasks.registerTask ();
220
+ var taskId = ( tasks != null ) ? tasks .registerTask () : 0 ;
221
221
Watch watch;
222
222
watch = scope.watch ('1' , // Cheat a bit.
223
223
(_, __) {
224
224
watch.remove ();
225
- tasks.completeTask (taskId);
225
+ if (tasks != null ) tasks.completeTask (taskId);
226
226
});
227
227
}
228
228
229
- tasks.doneRegistering ();
229
+ if (tasks != null ) tasks.doneRegistering ();
230
230
231
231
if (directive is DetachAware ) {
232
232
scope.on (ScopeEvent .DESTROY ).listen ((_) => directive.detach ());
0 commit comments