@@ -2315,44 +2315,29 @@ export const template_visitors = {
2315
2315
)
2316
2316
: /** @type {import('estree').Expression } */ ( context . visit ( node . key ) )
2317
2317
)
2318
- : b . literal ( null ) ;
2318
+ : b . id ( '$.index' ) ;
2319
2319
2320
2320
if ( node . index && each_node_meta . contains_group_binding ) {
2321
2321
// We needed to create a unique identifier for the index above, but we want to use the
2322
2322
// original index name in the template, therefore create another binding
2323
2323
declarations . push ( b . let ( node . index , index ) ) ;
2324
2324
}
2325
2325
2326
- let callee = '$.each_indexed' ;
2327
-
2328
- /** @type {import('estree').Expression[] } */
2329
- const args = [ ] ;
2330
-
2331
- if ( ( each_type & EACH_KEYED ) !== 0 ) {
2332
- if ( context . state . options . dev && key_function . type !== 'Literal' ) {
2333
- context . state . init . push (
2334
- b . stmt ( b . call ( '$.validate_each_keys' , b . thunk ( collection ) , key_function ) )
2335
- ) ;
2336
- }
2337
-
2338
- callee = '$.each_keyed' ;
2339
-
2340
- args . push (
2341
- context . state . node ,
2342
- b . literal ( each_type ) ,
2343
- each_node_meta . array_name ? each_node_meta . array_name : b . thunk ( collection ) ,
2344
- key_function ,
2345
- b . arrow ( [ b . id ( '$$anchor' ) , item , index ] , b . block ( declarations . concat ( children ) ) )
2346
- ) ;
2347
- } else {
2348
- args . push (
2349
- context . state . node ,
2350
- b . literal ( each_type ) ,
2351
- each_node_meta . array_name ? each_node_meta . array_name : b . thunk ( collection ) ,
2352
- b . arrow ( [ b . id ( '$$anchor' ) , item , index ] , b . block ( declarations . concat ( children ) ) )
2326
+ if ( context . state . options . dev && ( each_type & EACH_KEYED ) !== 0 ) {
2327
+ context . state . init . push (
2328
+ b . stmt ( b . call ( '$.validate_each_keys' , b . thunk ( collection ) , key_function ) )
2353
2329
) ;
2354
2330
}
2355
2331
2332
+ /** @type {import('estree').Expression[] } */
2333
+ const args = [
2334
+ context . state . node ,
2335
+ b . literal ( each_type ) ,
2336
+ each_node_meta . array_name ? each_node_meta . array_name : b . thunk ( collection ) ,
2337
+ key_function ,
2338
+ b . arrow ( [ b . id ( '$$anchor' ) , item , index ] , b . block ( declarations . concat ( children ) ) )
2339
+ ] ;
2340
+
2356
2341
if ( node . fallback ) {
2357
2342
args . push (
2358
2343
b . arrow (
@@ -2362,7 +2347,7 @@ export const template_visitors = {
2362
2347
) ;
2363
2348
}
2364
2349
2365
- context . state . init . push ( b . stmt ( b . call ( callee , ...args ) ) ) ;
2350
+ context . state . init . push ( b . stmt ( b . call ( '$.each' , ...args ) ) ) ;
2366
2351
} ,
2367
2352
IfBlock ( node , context ) {
2368
2353
context . state . template . push ( '<!>' ) ;
0 commit comments