@@ -79,7 +79,7 @@ pub enum Expression<'a> {
7979 ChainExpression ( Box <' a, ChainExpression <' a>>) = 16 ,
8080 ClassExpression ( Box <' a, Class <' a>>) = 17 ,
8181 ConditionalExpression ( Box <' a, ConditionalExpression <' a>>) = 18 ,
82- #[ visit_args( flags = None ) ]
82+ #[ visit_args( flags = ScopeFlags :: Function ) ]
8383 FunctionExpression ( Box <' a, Function <' a>>) = 19 ,
8484 ImportExpression ( Box <' a, ImportExpression <' a>>) = 20 ,
8585 LogicalExpression ( Box <' a, LogicalExpression <' a>>) = 21 ,
@@ -970,7 +970,7 @@ pub struct BlockStatement<'a> {
970970#[ cfg_attr( feature = "serialize" , serde( untagged) ) ]
971971pub enum Declaration < ' a > {
972972 VariableDeclaration ( Box < ' a , VariableDeclaration < ' a > > ) = 32 ,
973- #[ visit_args( flags = None ) ]
973+ #[ visit_args( flags = ScopeFlags :: Function ) ]
974974 FunctionDeclaration ( Box < ' a , Function < ' a > > ) = 33 ,
975975 ClassDeclaration ( Box < ' a , Class < ' a > > ) = 34 ,
976976 UsingDeclaration ( Box < ' a , UsingDeclaration < ' a > > ) = 35 ,
@@ -1437,8 +1437,8 @@ pub struct BindingRestElement<'a> {
14371437/// Function Definitions
14381438#[ visited_node]
14391439#[ scope(
1440- // TODO: `ScopeFlags::Function` is not correct if this is a `MethodDefinition`
1441- flags( flags. unwrap_or ( ScopeFlags :: empty ( ) ) | ScopeFlags :: Function ) ,
1440+ // `flags` passed in to visitor via parameter defined by `#[visit_args(flags = ...)]` on parents
1441+ flags( flags) ,
14421442 strict_if( self . is_strict( ) ) ,
14431443) ]
14441444#[ derive( Debug ) ]
@@ -1642,12 +1642,12 @@ pub struct MethodDefinition<'a> {
16421642 pub span : Span ,
16431643 pub decorators : Vec < ' a , Decorator < ' a > > ,
16441644 pub key : PropertyKey < ' a > ,
1645- #[ visit_args( flags = Some ( match self . kind {
1646- MethodDefinitionKind :: Get => ScopeFlags :: GetAccessor ,
1647- MethodDefinitionKind :: Set => ScopeFlags :: SetAccessor ,
1648- MethodDefinitionKind :: Constructor => ScopeFlags :: Constructor ,
1649- MethodDefinitionKind :: Method => ScopeFlags :: empty ( ) ,
1650- } ) ) ]
1645+ #[ visit_args( flags = match self . kind {
1646+ MethodDefinitionKind :: Get => ScopeFlags :: Function | ScopeFlags :: GetAccessor ,
1647+ MethodDefinitionKind :: Set => ScopeFlags :: Function | ScopeFlags :: SetAccessor ,
1648+ MethodDefinitionKind :: Constructor => ScopeFlags :: Function | ScopeFlags :: Constructor ,
1649+ MethodDefinitionKind :: Method => ScopeFlags :: Function ,
1650+ } ) ]
16511651 pub value : Box < ' a , Function < ' a > > , // FunctionExpression
16521652 pub kind : MethodDefinitionKind ,
16531653 pub computed : bool ,
@@ -1959,7 +1959,7 @@ inherit_variants! {
19591959#[ cfg_attr( feature = "serialize" , derive( Serialize , Tsify ) ) ]
19601960#[ cfg_attr( feature = "serialize" , serde( untagged) ) ]
19611961pub enum ExportDefaultDeclarationKind <' a> {
1962- #[ visit_args( flags = None ) ]
1962+ #[ visit_args( flags = ScopeFlags :: Function ) ]
19631963 FunctionDeclaration ( Box <' a, Function <' a>>) = 64 ,
19641964 ClassDeclaration ( Box <' a, Class <' a>>) = 65 ,
19651965
0 commit comments