mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(codegen): do not print comments when --minify
This commit is contained in:
parent
0410314278
commit
7b1546bb66
2 changed files with 6 additions and 2 deletions
|
|
@ -50,7 +50,7 @@ impl<'a> Codegen<'a> {
|
|||
&mut self,
|
||||
node_start: u32,
|
||||
) -> Vec<AnnotationComment> {
|
||||
if !self.comment_options.preserve_annotate_comments {
|
||||
if !self.preserve_annotate_comments() {
|
||||
return vec![];
|
||||
}
|
||||
let mut latest_comment_start = node_start;
|
||||
|
|
@ -127,7 +127,7 @@ impl<'a> Codegen<'a> {
|
|||
}
|
||||
|
||||
pub(crate) fn gen_comments(&mut self, node_start: u32) {
|
||||
if !self.comment_options.preserve_annotate_comments {
|
||||
if !self.preserve_annotate_comments() {
|
||||
return;
|
||||
}
|
||||
let mut annotation_kind_set = AnnotationKind::empty();
|
||||
|
|
|
|||
|
|
@ -519,6 +519,10 @@ impl<'a> Codegen<'a> {
|
|||
|
||||
// Comment related
|
||||
impl<'a> Codegen<'a> {
|
||||
fn preserve_annotate_comments(&self) -> bool {
|
||||
self.comment_options.preserve_annotate_comments && !self.options.minify
|
||||
}
|
||||
|
||||
/// Avoid issue related to rustc borrow checker .
|
||||
/// Since if you want to print a range of source code, you need to borrow the source code
|
||||
/// as immutable first, and call the [Self::print_str] which is a mutable borrow.
|
||||
|
|
|
|||
Loading…
Reference in a new issue