File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
packages/svelte/src/compiler/phases/3-transform/client/visitors Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -165,14 +165,18 @@ export function Program(node, context) {
165165 }
166166 } else {
167167 const pattern = b . array_pattern ( chunk . declarators . map ( ( { id } ) => id ) ) ;
168- const init = b . call ( '$.all' , ...chunk . declarators . map ( ( { init } ) => init ) ) ;
169- body . splice (
170- chunk . position + offset ,
171- 0 ,
172- b . declaration ( chunk . kind ?? 'const' , [
173- b . declarator ( pattern , b . call ( b . await ( b . call ( '$.save' , init ) ) ) )
174- ] )
168+ const init = b . call (
169+ b . await ( b . call ( '$.save' , b . call ( '$.all' , ...chunk . declarators . map ( ( { init } ) => init ) ) ) )
175170 ) ;
171+ if ( pattern . elements . every ( ( element ) => element === null ) ) {
172+ body . splice ( chunk . position + offset , 0 , b . stmt ( init ) ) ;
173+ } else {
174+ body . splice (
175+ chunk . position + offset ,
176+ 0 ,
177+ b . declaration ( chunk . kind ?? 'const' , [ b . declarator ( pattern , init ) ] )
178+ ) ;
179+ }
176180 }
177181 offset ++ ;
178182 }
You can’t perform that action at this time.
0 commit comments