@@ -575,7 +575,7 @@ export function* generate(
575575 if ( leftExpressionRange && leftExpressionText ) {
576576
577577 const collectAst = createTsAst ( node . parseResult , `const [${ leftExpressionText } ]` ) ;
578- collectVars ( ts , collectAst , forBlockVars ) ;
578+ collectVars ( ts , collectAst , collectAst , forBlockVars ) ;
579579
580580 for ( const varName of forBlockVars )
581581 localVars . set ( varName , ( localVars . get ( varName ) ?? 0 ) + 1 ) ;
@@ -871,7 +871,7 @@ export function* generate(
871871 ) ;
872872
873873 const slotAst = createTsAst ( slotDir , `(${ slotDir . exp . content } ) => {}` ) ;
874- collectVars ( ts , slotAst , slotBlockVars ) ;
874+ collectVars ( ts , slotAst , slotAst , slotBlockVars ) ;
875875 hasProps = true ;
876876 if ( slotDir . exp . content . indexOf ( ':' ) === - 1 ) {
877877 yield _ts ( 'const [' ) ;
@@ -1093,10 +1093,10 @@ export function* generate(
10931093 const ast = createTsAst ( prop . exp , prop . exp . content ) ;
10941094 let isCompoundExpression = true ;
10951095
1096- if ( ast . getChildCount ( ) === 2 ) { // with EOF
1097- ast . forEachChild ( child_1 => {
1096+ if ( ast . statements . length === 1 ) {
1097+ ts . forEachChild ( ast , child_1 => {
10981098 if ( ts . isExpressionStatement ( child_1 ) ) {
1099- child_1 . forEachChild ( child_2 => {
1099+ ts . forEachChild ( child_1 , child_2 => {
11001100 if ( ts . isArrowFunction ( child_2 ) ) {
11011101 isCompoundExpression = false ;
11021102 }
@@ -1902,7 +1902,7 @@ export function* generate(
19021902 function createTsAst ( astHolder : any , text : string ) {
19031903 if ( astHolder . __volar_ast_text !== text ) {
19041904 astHolder . __volar_ast_text = text ;
1905- astHolder . __volar_ast = ts . createSourceFile ( '/a.ts' , text , ts . ScriptTarget . ESNext ) ;
1905+ astHolder . __volar_ast = ts . createSourceFile ( '/a.ts' , text , 99 satisfies ts . ScriptTarget . ESNext ) ;
19061906 }
19071907 return astHolder . __volar_ast as ts . SourceFile ;
19081908 }
0 commit comments