Skip to content

Commit 4ed6304

Browse files
Copilotcamc314
andcommitted
Fix duplicate export modifier diagnostic message
- Changed diagnostic from "export modifier must precede declare modifier" to "export modifier already seen" - Skip adding duplicate export modifier to the modifiers list to avoid secondary validation error - Add test case for duplicate export modifier - Handle empty modifiers case when all modifiers are skipped Co-authored-by: camc314 <[email protected]>
1 parent 590398a commit 4ed6304

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/oxc_parser/src/modifiers.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,11 @@ impl<'a> ParserImpl<'a> {
339339
flags.set(modifier_flags, true);
340340
modifiers.push(modifier);
341341
}
342-
Modifiers::new(Some(modifiers), flags)
342+
if modifiers.is_empty() {
343+
Modifiers::empty()
344+
} else {
345+
Modifiers::new(Some(modifiers), flags)
346+
}
343347
}
344348

345349
fn at_modifier(&mut self) -> bool {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export export function foo() {
2+
}

0 commit comments

Comments
 (0)