Skip to content

Commit

Permalink
refactor(ast_codegen): no longer outputs discard variable for empty v…
Browse files Browse the repository at this point in the history
…isitors.
  • Loading branch information
rzvxa committed Jul 2, 2024
1 parent bd20e86 commit 40e3abd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions crates/oxc_ast/src/generated/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,6 @@ pub mod walk {

pub fn walk_template_element<'a, V: Visit<'a>>(visitor: &mut V, it: &TemplateElement<'a>) {
// NOTE: AstKind doesn't exists!
let _ = (visitor, it);
}

pub fn walk_expressions<'a, V: Visit<'a>>(visitor: &mut V, it: &Vec<'a, Expression<'a>>) {
Expand Down Expand Up @@ -2480,7 +2479,6 @@ pub mod walk {

pub fn walk_js_doc_unknown_type<'a, V: Visit<'a>>(visitor: &mut V, it: &JSDocUnknownType) {
// NOTE: AstKind doesn't exists!
let _ = (visitor, it);
}

pub fn walk_decorators<'a, V: Visit<'a>>(visitor: &mut V, it: &Vec<'a, Decorator<'a>>) {
Expand Down Expand Up @@ -3217,7 +3215,6 @@ pub mod walk {

pub fn walk_jsx_empty_expression<'a, V: Visit<'a>>(visitor: &mut V, it: &JSXEmptyExpression) {
// NOTE: AstKind doesn't exists!
let _ = (visitor, it);
}

pub fn walk_jsx_fragment<'a, V: Visit<'a>>(visitor: &mut V, it: &JSXFragment<'a>) {
Expand Down
3 changes: 0 additions & 3 deletions crates/oxc_ast/src/generated/visit_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,6 @@ pub mod walk_mut {
it: &mut TemplateElement<'a>,
) {
// NOTE: AstType doesn't exists!
let _ = (visitor, it);
}

pub fn walk_expressions<'a, V: VisitMut<'a>>(
Expand Down Expand Up @@ -2584,7 +2583,6 @@ pub mod walk_mut {
it: &mut JSDocUnknownType,
) {
// NOTE: AstType doesn't exists!
let _ = (visitor, it);
}

pub fn walk_decorators<'a, V: VisitMut<'a>>(visitor: &mut V, it: &mut Vec<'a, Decorator<'a>>) {
Expand Down Expand Up @@ -3378,7 +3376,6 @@ pub mod walk_mut {
it: &mut JSXEmptyExpression,
) {
// NOTE: AstType doesn't exists!
let _ = (visitor, it);
}

pub fn walk_jsx_fragment<'a, V: VisitMut<'a>>(visitor: &mut V, it: &mut JSXFragment<'a>) {
Expand Down
3 changes: 0 additions & 3 deletions tasks/ast_codegen/src/generators/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,16 +583,13 @@ impl<'a> VisitBuilder<'a> {
.collect();

let body = if KIND_BLACK_LIST.contains(&ident.to_string().as_str()) {
let unused =
if fields_visits.is_empty() { Some(quote!(let _ = (visitor, it);)) } else { None };
let note = insert!(
"// NOTE: {} doesn't exists!",
if self.is_mut { "AstType" } else { "AstKind" }
);
quote! {
#note
#(#fields_visits)*
#unused
}
} else {
let kind = self.kind_type(ident);
Expand Down

0 comments on commit 40e3abd

Please sign in to comment.