@@ -47,7 +47,9 @@ export function VariableDeclaration(node, context) {
47
47
48
48
continue ;
49
49
}
50
+ const kind = node . kind ;
50
51
if (
52
+ kind !== 'using' && kind !== 'await using' &&
51
53
init ?. type === 'AwaitExpression' &&
52
54
context . state . analysis . instance ?. scope === context . state . scope &&
53
55
! is_expression_async ( init . argument )
@@ -72,16 +74,16 @@ export function VariableDeclaration(node, context) {
72
74
} ;
73
75
if (
74
76
current_chunk &&
75
- ( current_chunk . kind === node . kind || current_chunk . kind === null )
77
+ ( current_chunk . kind === kind || current_chunk . kind === null )
76
78
) {
77
79
current_chunk . declarators . push ( _declarator ) ;
78
80
current_chunk . bindings . push ( ...bindings ) ;
79
81
current_chunk . position = /** @type {Program } */ ( parent ) . body . indexOf ( node ) ;
80
- current_chunk . kind = node . kind ;
82
+ current_chunk . kind = kind ;
81
83
} else {
82
84
/** @type {ParallelizedChunk } */
83
85
const chunk = {
84
- kind : node . kind ,
86
+ kind,
85
87
declarators : [ _declarator ] ,
86
88
position,
87
89
bindings
@@ -179,11 +181,13 @@ export function VariableDeclaration(node, context) {
179
181
if ( rune === '$state' || rune === '$state.raw' ) {
180
182
const state_declarators = [ ] ;
181
183
const current_chunk = context . state . current_parallelized_chunk ;
184
+ const kind = node . kind ;
182
185
const parallelize =
183
186
declarator . id . type === 'Identifier' &&
184
187
context . state . analysis . instance ?. scope === context . state . scope &&
185
188
value . type === 'AwaitExpression' &&
186
189
! is_expression_async ( value . argument ) &&
190
+ kind !== 'using' && kind !== 'await using' &&
187
191
can_be_parallelized ( value . argument , context . state . scope , context . state . analysis , [
188
192
...( current_chunk ?. bindings ?? [ ] ) ,
189
193
...bindings
@@ -294,11 +298,11 @@ export function VariableDeclaration(node, context) {
294
298
current_chunk . declarators . push ( ...declarators ) ;
295
299
current_chunk . bindings . push ( ...bindings ) ;
296
300
current_chunk . position = position ;
297
- current_chunk . kind = node . kind ;
301
+ current_chunk . kind = kind ;
298
302
} else {
299
303
/** @type {ParallelizedChunk } */
300
304
const chunk = {
301
- kind : node . kind ,
305
+ kind,
302
306
declarators,
303
307
position,
304
308
bindings
@@ -322,13 +326,15 @@ export function VariableDeclaration(node, context) {
322
326
context . state . analysis . instance &&
323
327
context . state . scope === context . state . analysis . instance . scope &&
324
328
// TODO make it work without this
325
- declarator . id . type === 'Identifier'
329
+ declarator . id . type === 'Identifier' &&
330
+ node . kind !== 'await using' && node . kind !== 'using'
326
331
) {
327
332
parallelize = can_be_parallelized ( value , context . state . scope , context . state . analysis , [
328
333
...( current_chunk ?. bindings ?? [ ] ) ,
329
334
...context . state . scope . get_bindings ( declarator )
330
335
] ) ;
331
336
}
337
+ const kind = /** @type {ParallelizedChunk['kind'] } */ ( node . kind ) ;
332
338
333
339
/** @type {VariableDeclarator[] } */
334
340
const derived_declarators = [ ] ;
@@ -428,15 +434,15 @@ export function VariableDeclaration(node, context) {
428
434
id,
429
435
init : /** @type {Expression } */ ( init )
430
436
} ) ) ;
431
- if ( current_chunk && ( current_chunk . kind === node . kind || current_chunk . kind === null ) ) {
437
+ if ( current_chunk && ( current_chunk . kind === kind || current_chunk . kind === null ) ) {
432
438
current_chunk . declarators . push ( ...declarators ) ;
433
439
current_chunk . bindings . push ( ...bindings ) ;
434
440
current_chunk . position = position ;
435
- current_chunk . kind = node . kind ;
441
+ current_chunk . kind = kind ;
436
442
} else {
437
443
/** @type {ParallelizedChunk } */
438
444
const chunk = {
439
- kind : node . kind ,
445
+ kind,
440
446
declarators,
441
447
position,
442
448
bindings
0 commit comments