@@ -949,7 +949,6 @@ const instance_script = {
949
949
const ids = extract_identifiers ( left ) ;
950
950
const [ , expression_ids ] = extract_all_identifiers_from_expression ( right ) ;
951
951
const bindings = ids . map ( ( id ) => /** @type {Binding } */ ( state . scope . get ( id . name ) ) ) ;
952
- const reassigned_bindings = bindings . filter ( ( b ) => b . reassigned ) ;
953
952
954
953
if ( bindings . every ( ( b ) => b . kind === 'legacy_reactive' ) ) {
955
954
if (
@@ -982,28 +981,29 @@ const instance_script = {
982
981
}
983
982
984
983
return ;
985
- } else {
986
- for ( const binding of reassigned_bindings ) {
987
- if ( binding && ( ids . includes ( binding . node ) || expression_ids . length === 0 ) ) {
988
- check_rune_binding ( 'state' ) ;
989
- const init =
990
- binding . kind === 'state'
991
- ? ' = $state()'
992
- : expression_ids . length === 0
993
- ? ` = $state(${ state . str . original . substring ( /** @type {number } */ ( right . start ) , right . end ) } )`
994
- : '' ;
995
- // implicitly-declared variable which we need to make explicit
996
- state . str . prependLeft (
997
- /** @type {number } */ ( node . start ) ,
998
- `let ${ binding . node . name } ${ init } ;\n${ state . indent } `
999
- ) ;
1000
- }
1001
- }
1002
- if ( expression_ids . length === 0 && ! bindings . some ( ( b ) => b . kind === 'store_sub' ) ) {
1003
- state . str . remove ( /** @type {number } */ ( node . start ) , /** @type {number } */ ( node . end ) ) ;
1004
- return ;
984
+ }
985
+
986
+ for ( const binding of bindings ) {
987
+ if ( binding . reassigned && ( ids . includes ( binding . node ) || expression_ids . length === 0 ) ) {
988
+ check_rune_binding ( 'state' ) ;
989
+ const init =
990
+ binding . kind === 'state'
991
+ ? ' = $state()'
992
+ : expression_ids . length === 0
993
+ ? ` = $state(${ state . str . original . substring ( /** @type {number } */ ( right . start ) , right . end ) } )`
994
+ : '' ;
995
+ // implicitly-declared variable which we need to make explicit
996
+ state . str . prependLeft (
997
+ /** @type {number } */ ( node . start ) ,
998
+ `let ${ binding . node . name } ${ init } ;\n${ state . indent } `
999
+ ) ;
1005
1000
}
1006
1001
}
1002
+
1003
+ if ( expression_ids . length === 0 && bindings . every ( ( b ) => b . kind !== 'store_sub' ) ) {
1004
+ state . str . remove ( /** @type {number } */ ( node . start ) , /** @type {number } */ ( node . end ) ) ;
1005
+ return ;
1006
+ }
1007
1007
}
1008
1008
}
1009
1009
0 commit comments