File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed
Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -1675,7 +1675,7 @@ impl<'a> SemanticBuilder<'a> {
16751675 func. id . is_some ( )
16761676 }
16771677 ExportDefaultDeclarationKind :: ClassDeclaration ( ref class) => class. id . is_some ( ) ,
1678- _ => true ,
1678+ _ => false ,
16791679 } {
16801680 self . current_symbol_flags |= SymbolFlags :: Export ;
16811681 }
Original file line number Diff line number Diff line change @@ -133,12 +133,19 @@ fn test_export_flag() {
133133 class b {}
134134 export default c;
135135 function c() {}
136+
137+ export default (function funcExpr() {});
138+ export default (function(param) {});
139+
136140 " ,
137141 ) ;
138142
139- tester. has_root_symbol ( "a" ) . contains_flags ( SymbolFlags :: Export ) . test ( ) ;
140- tester. has_root_symbol ( "b" ) . contains_flags ( SymbolFlags :: Export ) . test ( ) ;
141- tester. has_root_symbol ( "c" ) . contains_flags ( SymbolFlags :: Export ) . test ( ) ;
143+ tester. has_root_symbol ( "a" ) . is_exported ( ) . test ( ) ;
144+ tester. has_root_symbol ( "b" ) . is_exported ( ) . test ( ) ;
145+ tester. has_root_symbol ( "c" ) . is_exported ( ) . test ( ) ;
146+
147+ tester. has_symbol ( "funcExpr" ) . is_not_exported ( ) . test ( ) ;
148+ tester. has_symbol ( "param" ) . is_not_exported ( ) . test ( ) ;
142149}
143150
144151#[ test]
Original file line number Diff line number Diff line change @@ -137,6 +137,25 @@ impl<'a> SymbolTester<'a> {
137137 self
138138 }
139139
140+ /// Checks if the resolved symbol does not contain any flags in `flags`, using ! [`SymbolFlags::contains()`]
141+ pub fn does_not_contain_flags ( mut self , flags : SymbolFlags ) -> Self {
142+ self . test_result = match self . test_result {
143+ Ok ( symbol_id) => {
144+ let found_flags = self . semantic . symbols ( ) . get_flag ( symbol_id) ;
145+ if !found_flags. contains ( flags) {
146+ Ok ( symbol_id)
147+ } else {
148+ Err ( OxcDiagnostic :: error ( format ! (
149+ "Expected {} to not contain flags {:?}, but it had {:?}" ,
150+ self . target_symbol_name, flags, found_flags
151+ ) ) )
152+ }
153+ }
154+ err => err,
155+ } ;
156+ self
157+ }
158+
140159 pub fn intersects_flags ( mut self , flags : SymbolFlags ) -> Self {
141160 self . test_result = match self . test_result {
142161 Ok ( symbol_id) => {
You can’t perform that action at this time.
0 commit comments