-
-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: 🤖 more annotation comments gen
- Loading branch information
1 parent
44c7fe3
commit 4566099
Showing
4 changed files
with
72 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use oxc_ast::ast::{ArrowFunctionExpression, CallExpression, Function, NewExpression}; | ||
|
||
use crate::annotation_comment::gen_comment; | ||
use crate::{Codegen, Context}; | ||
|
||
/// the [GenComment] trait only generate annotate comments like `/* @__PURE__ */` and `/* @__NO_SIDE_EFFECTS__ */`. | ||
pub trait GenComment<const MINIFY: bool> { | ||
fn gen_comment(&self, _p: &mut Codegen<{ MINIFY }>, _ctx: Context) {} | ||
} | ||
|
||
impl<const MINIFY: bool> GenComment<MINIFY> for ArrowFunctionExpression<'_> { | ||
fn gen_comment(&self, codegen: &mut Codegen<{ MINIFY }>, _ctx: Context) { | ||
gen_comment(self.span.start, codegen); | ||
} | ||
} | ||
|
||
impl<const MINIFY: bool> GenComment<MINIFY> for Function<'_> { | ||
fn gen_comment(&self, codegen: &mut Codegen<{ MINIFY }>, _ctx: Context) { | ||
gen_comment(self.span.start, codegen); | ||
} | ||
} | ||
|
||
impl<const MINIFY: bool> GenComment<MINIFY> for CallExpression<'_> { | ||
fn gen_comment(&self, codegen: &mut Codegen<{ MINIFY }>, _ctx: Context) { | ||
gen_comment(self.span.start, codegen); | ||
} | ||
} | ||
|
||
impl<const MINIFY: bool> GenComment<MINIFY> for NewExpression<'_> { | ||
fn gen_comment(&self, codegen: &mut Codegen<{ MINIFY }>, _ctx: Context) { | ||
gen_comment(self.span.start, codegen); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters