@@ -13,17 +13,6 @@ export function AssignmentExpression(node, context) {
13
13
const parent = /** @type {Node } */ ( context . path . at ( - 1 ) ) ;
14
14
const is_standalone = parent . type . endsWith ( 'Statement' ) ;
15
15
16
- return serialize_assignment ( node , context , is_standalone , context . next ) ;
17
- }
18
-
19
- /**
20
- * @param {AssignmentExpression } node
21
- * @param {import('zimmerframe').Context<SvelteNode, ServerTransformState> } context
22
- * @param {boolean } is_standalone
23
- * @param {() => any } fallback
24
- * @returns {Expression }
25
- */
26
- function serialize_assignment ( node , context , is_standalone , fallback ) {
27
16
if (
28
17
node . left . type === 'ArrayPattern' ||
29
18
node . left . type === 'ObjectPattern' ||
@@ -38,15 +27,15 @@ function serialize_assignment(node, context, is_standalone, fallback) {
38
27
const assignments = extract_paths ( node . left ) . map ( ( path ) => {
39
28
const assignment = b . assignment ( '=' , path . node , path . expression ?. ( rhs ) ) ;
40
29
41
- return serialize_assignment ( assignment , context , false , ( ) => {
30
+ return serialize_assignment ( assignment , context , ( ) => {
42
31
unchanged += 1 ;
43
32
return assignment ;
44
33
} ) ;
45
34
} ) ;
46
35
47
36
if ( unchanged === assignments . length ) {
48
37
// No change to output -> nothing to transform -> we can keep the original assignment
49
- return fallback ( ) ;
38
+ return context . next ( ) ;
50
39
}
51
40
52
41
const sequence = b . sequence ( assignments ) ;
@@ -64,6 +53,16 @@ function serialize_assignment(node, context, is_standalone, fallback) {
64
53
return sequence ;
65
54
}
66
55
56
+ return serialize_assignment ( node , context , context . next ) ;
57
+ }
58
+
59
+ /**
60
+ * @param {AssignmentExpression } node
61
+ * @param {import('zimmerframe').Context<SvelteNode, ServerTransformState> } context
62
+ * @param {() => any } fallback
63
+ * @returns {Expression }
64
+ */
65
+ function serialize_assignment ( node , context , fallback ) {
67
66
let left = node . left ;
68
67
69
68
while ( left . type === 'MemberExpression' ) {
0 commit comments