Skip to content

Commit 32f8148

Browse files
committed
chore: workaround swc bug I introduced.
1 parent 582e5fe commit 32f8148

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/parsing/parser.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2963,7 +2963,10 @@ fn parse_module<'a>(node: &'a Module, context: &mut Context<'a>) -> PrintItems {
29632963
}
29642964
} else {
29652965
let shebang_end = BytePos(("#!".len() + shebang.len()) as u32);
2966-
items.extend(parse_trailing_comments_as_statements(&shebang_end, context));
2966+
// todo: re-enable once swc bug is fixed and remove the code below
2967+
// items.extend(parse_trailing_comments_as_statements(&shebang_end, context));
2968+
let trailing_comments = shebang_end.leading_comments_fast(context.module);
2969+
items.extend(parse_comments_as_statements(trailing_comments, Some(&shebang_end), context));
29672970
}
29682971
}
29692972

tests/specs/statements/sheBang/SheBang_All.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
[expect]
5555
#!/foo/bar
56+
5657
// A comment
5758
/* A block comment */
5859

0 commit comments

Comments
 (0)