File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed 
packages/svelte/src/compiler/phases/3-transform/client/visitors Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ ' svelte '  : patch 
3+ --- 
4+ 
5+ fix: allow await expressions inside ` {#await ...} `  argument
Original file line number Diff line number Diff line change 11/** @import  { BlockStatement, Pattern, Statement } from 'estree' */ 
22/** @import  { AST } from '#compiler' */ 
33/** @import  { ComponentClientTransformState, ComponentContext } from '../types' */ 
4- import  {  extract_identifiers  }  from  '../../../../utils/ast.js' ; 
4+ import  {  extract_identifiers ,   is_expression_async  }  from  '../../../../utils/ast.js' ; 
55import  *  as  b  from  '#compiler/builders' ; 
66import  {  create_derived  }  from  '../utils.js' ; 
77import  {  get_value  }  from  './shared/declarations.js' ; 
@@ -15,7 +15,11 @@ export function AwaitBlock(node, context) {
1515	context . state . template . push_comment ( ) ; 
1616
1717	// Visit {#await <expression>} first to ensure that scopes are in the correct order 
18- 	const  expression  =  b . thunk ( build_expression ( context ,  node . expression ,  node . metadata . expression ) ) ; 
18+ 	const  unthunked  =  build_expression ( context ,  node . expression ,  node . metadata . expression ) ; 
19+ 	const  expression  =  b . thunk ( 
20+ 		unthunked , 
21+ 		context . state . options . experimental . async  &&  is_expression_async ( unthunked ) 
22+ 	) ; 
1923
2024	let  then_block ; 
2125	let  catch_block ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments