@@ -599,26 +599,38 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
599
599
} ,
600
600
601
601
AwaitBlock ( node , context ) {
602
- context . next ( ) ;
602
+ context . visit ( node . expression ) ;
603
+
604
+ if ( node . pending ) {
605
+ context . visit ( node . pending ) ;
606
+ }
603
607
604
- if ( node . then && node . value !== null ) {
605
- const then_scope = /** @type {Scope } */ ( scopes . get ( node . then ) ) ;
606
- const value_scope = context . state . scope . child ( ) ;
607
- for ( const id of extract_identifiers ( node . value ) ) {
608
- then_scope . declare ( id , 'normal' , 'const' ) ;
609
- value_scope . declare ( id , 'normal' , 'const' ) ;
608
+ if ( node . then ) {
609
+ context . visit ( node . then ) ;
610
+ if ( node . value ) {
611
+ const then_scope = /** @type {Scope } */ ( scopes . get ( node . then ) ) ;
612
+ const value_scope = context . state . scope . child ( ) ;
613
+ scopes . set ( node . value , value_scope ) ;
614
+ context . visit ( node . value , { scope : value_scope } ) ;
615
+ for ( const id of extract_identifiers ( node . value ) ) {
616
+ then_scope . declare ( id , 'normal' , 'const' ) ;
617
+ value_scope . declare ( id , 'normal' , 'const' ) ;
618
+ }
610
619
}
611
- scopes . set ( node . value , value_scope ) ;
612
620
}
613
621
614
- if ( node . catch && node . error !== null ) {
615
- const catch_scope = /** @type {Scope } */ ( scopes . get ( node . catch ) ) ;
616
- const error_scope = context . state . scope . child ( ) ;
617
- for ( const id of extract_identifiers ( node . error ) ) {
618
- catch_scope . declare ( id , 'normal' , 'const' ) ;
619
- error_scope . declare ( id , 'normal' , 'const' ) ;
622
+ if ( node . catch ) {
623
+ context . visit ( node . catch ) ;
624
+ if ( node . error ) {
625
+ const catch_scope = /** @type {Scope } */ ( scopes . get ( node . catch ) ) ;
626
+ const error_scope = context . state . scope . child ( ) ;
627
+ scopes . set ( node . error , error_scope ) ;
628
+ context . visit ( node . error , { scope : error_scope } ) ;
629
+ for ( const id of extract_identifiers ( node . error ) ) {
630
+ catch_scope . declare ( id , 'normal' , 'const' ) ;
631
+ error_scope . declare ( id , 'normal' , 'const' ) ;
632
+ }
620
633
}
621
- scopes . set ( node . error , error_scope ) ;
622
634
}
623
635
} ,
624
636
0 commit comments