@@ -288,41 +288,7 @@ export default class Expression {
288
288
this . skip ( ) ;
289
289
}
290
290
291
- if ( function_expression ) {
292
- if ( node . type === 'AssignmentExpression' ) {
293
- const names = node . left . type === 'MemberExpression'
294
- ? [ get_object ( node . left ) . name ]
295
- : extract_names ( node . left ) ;
296
-
297
- if ( node . operator === '=' && nodes_match ( node . left , node . right ) ) {
298
- const dirty = names . filter ( name => {
299
- return ! scope . declarations . has ( name ) ;
300
- } ) ;
301
-
302
- if ( dirty . length ) component . has_reactive_assignments = true ;
303
-
304
- code . overwrite ( node . start , node . end , dirty . map ( n => component . invalidate ( n ) ) . join ( '; ' ) ) ;
305
- } else {
306
- names . forEach ( name => {
307
- if ( scope . declarations . has ( name ) ) return ;
308
-
309
- const variable = component . var_lookup . get ( name ) ;
310
- if ( variable && variable . hoistable ) return ;
311
-
312
- pending_assignments . add ( name ) ;
313
- } ) ;
314
- }
315
- } else if ( node . type === 'UpdateExpression' ) {
316
- const { name } = get_object ( node . argument ) ;
317
-
318
- if ( scope . declarations . has ( name ) ) return ;
319
-
320
- const variable = component . var_lookup . get ( name ) ;
321
- if ( variable && variable . hoistable ) return ;
322
-
323
- pending_assignments . add ( name ) ;
324
- }
325
- } else {
291
+ if ( ! function_expression ) {
326
292
if ( node . type === 'AssignmentExpression' ) {
327
293
// TODO should this be a warning/error? `<p>{foo = 1}</p>`
328
294
}
@@ -447,6 +413,40 @@ export default class Expression {
447
413
contextual_dependencies = null ;
448
414
}
449
415
416
+ if ( node . type === 'AssignmentExpression' ) {
417
+ const names = node . left . type === 'MemberExpression'
418
+ ? [ get_object ( node . left ) . name ]
419
+ : extract_names ( node . left ) ;
420
+
421
+ if ( node . operator === '=' && nodes_match ( node . left , node . right ) ) {
422
+ const dirty = names . filter ( name => {
423
+ return ! scope . declarations . has ( name ) ;
424
+ } ) ;
425
+
426
+ if ( dirty . length ) component . has_reactive_assignments = true ;
427
+
428
+ code . overwrite ( node . start , node . end , dirty . map ( n => component . invalidate ( n ) ) . join ( '; ' ) ) ;
429
+ } else {
430
+ names . forEach ( name => {
431
+ if ( scope . declarations . has ( name ) ) return ;
432
+
433
+ const variable = component . var_lookup . get ( name ) ;
434
+ if ( variable && variable . hoistable ) return ;
435
+
436
+ pending_assignments . add ( name ) ;
437
+ } ) ;
438
+ }
439
+ } else if ( node . type === 'UpdateExpression' ) {
440
+ const { name } = get_object ( node . argument ) ;
441
+
442
+ if ( scope . declarations . has ( name ) ) return ;
443
+
444
+ const variable = component . var_lookup . get ( name ) ;
445
+ if ( variable && variable . hoistable ) return ;
446
+
447
+ pending_assignments . add ( name ) ;
448
+ }
449
+
450
450
if ( / S t a t e m e n t / . test ( node . type ) ) {
451
451
if ( pending_assignments . size > 0 ) {
452
452
const has_semi = code . original [ node . end - 1 ] === ';' ;
0 commit comments