@ -1,7 +1,7 @@
/** @import { CallExpression, Expression, Identifier, Literal, VariableDeclaration, VariableDeclarator } from 'estree' */
/** @import { CallExpression, Expression, Identifier, Literal, VariableDeclaration, VariableDeclarator } from 'estree' */
/** @import { Binding } from '#compiler' */
/** @import { Binding } from '#compiler' */
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
import { dev } from '../../../../state.js' ;
import { dev , is _ignored , locate _node } from '../../../../state.js' ;
import { extract _paths } from '../../../../utils/ast.js' ;
import { extract _paths } from '../../../../utils/ast.js' ;
import * as b from '../../../../utils/builders.js' ;
import * as b from '../../../../utils/builders.js' ;
import * as assert from '../../../../utils/assert.js' ;
import * as assert from '../../../../utils/assert.js' ;
@ -19,7 +19,7 @@ export function VariableDeclaration(node, context) {
if ( context . state . analysis . runes ) {
if ( context . state . analysis . runes ) {
for ( const declarator of node . declarations ) {
for ( const declarator of node . declarations ) {
const init = declarator . init ;
const init = /** @type {Expression} */ ( declarator . init ) ;
const rune = get _rune ( init , context . state . scope ) ;
const rune = get _rune ( init , context . state . scope ) ;
if (
if (
@ -164,10 +164,23 @@ export function VariableDeclaration(node, context) {
if ( declarator . id . type === 'Identifier' ) {
if ( declarator . id . type === 'Identifier' ) {
if ( is _async ) {
if ( is _async ) {
const location = dev && is _ignored ( init , 'await_waterfall' ) && locate _node ( init ) ;
declarations . push (
declarations . push (
b . declarator (
b . declarator (
declarator . id ,
declarator . id ,
b . call ( b . await ( b . call ( '$.save' , b . call ( '$.async_derived' , b . thunk ( value , true ) ) ) ) )
b . call (
b . await (
b . call (
'$.save' ,
b . call (
'$.async_derived' ,
b . thunk ( value , true ) ,
location ? b . literal ( location ) : undefined
)
)
)
)
)
)
) ;
) ;
} else {
} else {