@@ -35,7 +35,6 @@ function sort_const_tags(nodes, state) {
35
35
/**
36
36
* @typedef {{
37
37
* node: import('#compiler').ConstTag;
38
- * ids: import('#compiler').Binding[];
39
38
* deps: Set<import('#compiler').Binding>;
40
39
* }} Tag
41
40
*/
@@ -51,19 +50,12 @@ function sort_const_tags(nodes, state) {
51
50
if ( node . type === 'ConstTag' ) {
52
51
const declaration = node . declaration . declarations [ 0 ] ;
53
52
54
- /** @type {Tag } */
55
- const tag = {
56
- node,
57
- ids : extract_identifiers ( declaration . id ) . map ( ( id ) => {
58
- return /** @type {import('#compiler').Binding } */ ( state . scope . get ( id . name ) ) ;
59
- } ) ,
60
- /** @type {Set<import('#compiler').Binding> } */
61
- deps : new Set ( )
62
- } ;
63
-
64
- for ( const id of tag . ids ) {
65
- tags . set ( id , tag ) ;
66
- }
53
+ const bindings = extract_identifiers ( declaration . id ) . map ( ( id ) => {
54
+ return /** @type {import('#compiler').Binding } */ ( state . scope . get ( id . name ) ) ;
55
+ } ) ;
56
+
57
+ /** @type {Set<import('#compiler').Binding> } */
58
+ const deps = new Set ( ) ;
67
59
68
60
walk ( declaration . init , state , {
69
61
_,
@@ -72,10 +64,14 @@ function sort_const_tags(nodes, state) {
72
64
73
65
if ( is_reference ( node , parent ) ) {
74
66
const binding = context . state . scope . get ( node . name ) ;
75
- if ( binding ) tag . deps . add ( binding ) ;
67
+ if ( binding ) deps . add ( binding ) ;
76
68
}
77
69
}
78
70
} ) ;
71
+
72
+ for ( const binding of bindings ) {
73
+ tags . set ( binding , { node, deps } ) ;
74
+ }
79
75
} else {
80
76
other . push ( node ) ;
81
77
}
0 commit comments