Skip to content

Commit e820fc5

Browse files
committed
revert ast.js changes for now
1 parent 9b9a268 commit e820fc5

File tree

1 file changed

+10
-13
lines changed
  • packages/svelte/src/compiler/utils

1 file changed

+10
-13
lines changed

packages/svelte/src/compiler/utils/ast.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,50 +54,47 @@ export function is_event_attribute(attribute) {
5454
}
5555

5656
/**
57-
* Extracts all identifiers from a pattern. By default only those which can be newly declared as part of an assignment expression are included.
57+
* Extracts all identifiers from a pattern.
5858
* @param {ESTree.Pattern} param
5959
* @param {ESTree.Identifier[]} [nodes]
60-
* @param {boolean} [include_member_expressions] If `true`, will also include member expressions which can be important in a case like `[a, b] = [c, d]`
6160
* @returns {ESTree.Identifier[]}
6261
*/
63-
export function extract_identifiers(param, nodes = [], include_member_expressions = false) {
62+
export function extract_identifiers(param, nodes = []) {
6463
switch (param.type) {
6564
case 'Identifier':
6665
nodes.push(param);
6766
break;
6867

6968
case 'MemberExpression':
70-
if (include_member_expressions) {
71-
// Only the `a` from `[a.b[c].d]` is of interest to us here
72-
const id = object(param);
73-
if (id) nodes.push(id);
74-
}
69+
// Only the `a` from `[a.b[c].d]` is of interest to us here
70+
const id = object(param);
71+
if (id) nodes.push(id);
7572
break;
7673

7774
case 'ObjectPattern':
7875
for (const prop of param.properties) {
7976
if (prop.type === 'RestElement') {
80-
extract_identifiers(prop.argument, nodes, include_member_expressions);
77+
extract_identifiers(prop.argument, nodes);
8178
} else {
82-
extract_identifiers(prop.value, nodes, include_member_expressions);
79+
extract_identifiers(prop.value, nodes);
8380
}
8481
}
8582

8683
break;
8784

8885
case 'ArrayPattern':
8986
for (const element of param.elements) {
90-
if (element) extract_identifiers(element, nodes, include_member_expressions);
87+
if (element) extract_identifiers(element, nodes);
9188
}
9289

9390
break;
9491

9592
case 'RestElement':
96-
extract_identifiers(param.argument, nodes, include_member_expressions);
93+
extract_identifiers(param.argument, nodes);
9794
break;
9895

9996
case 'AssignmentPattern':
100-
extract_identifiers(param.left, nodes, include_member_expressions);
97+
extract_identifiers(param.left, nodes);
10198
break;
10299
}
103100

0 commit comments

Comments
 (0)