Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ast_codegen): no longer outputs discard variable for empty visitors. #4008

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading