Skip to content

Commit

Permalink
refactor(ast_codegen): use stringify for generators names. (#4388)
Browse files Browse the repository at this point in the history
The generator name is always the same as its identifier so this PR changes all `"<generator_ident>"` to `stringify!(<generator_ident>)`
  • Loading branch information
rzvxa committed Aug 2, 2024
1 parent eae401c commit 8685932
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tasks/ast_codegen/src/generators/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct AstBuilderGenerator;

impl Generator for AstBuilderGenerator {
fn name(&self) -> &'static str {
"AstBuilderGenerator"
stringify!(AstBuilderGenerator)
}

fn generate(&mut self, ctx: &CodegenCtx) -> GeneratorOutput {
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_codegen/src/generators/ast_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub fn process_types(ty: &TypeRef) -> Vec<(Ident, Type)> {

impl Generator for AstKindGenerator {
fn name(&self) -> &'static str {
"AstKindGenerator"
stringify!(AstKindGenerator)
}

fn generate(&mut self, ctx: &CodegenCtx) -> GeneratorOutput {
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_codegen/src/generators/impl_get_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct ImplGetSpanGenerator;

impl Generator for ImplGetSpanGenerator {
fn name(&self) -> &'static str {
"ImplGetSpanGenerator"
stringify!(ImplGetSpanGenerator)
}

fn generate(&mut self, ctx: &CodegenCtx) -> GeneratorOutput {
Expand Down
4 changes: 2 additions & 2 deletions tasks/ast_codegen/src/generators/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct VisitMutGenerator;

impl Generator for VisitGenerator {
fn name(&self) -> &'static str {
"VisitGenerator"
stringify!(VisitGenerator)
}

fn generate(&mut self, ctx: &CodegenCtx) -> GeneratorOutput {
Expand All @@ -47,7 +47,7 @@ impl Generator for VisitGenerator {

impl Generator for VisitMutGenerator {
fn name(&self) -> &'static str {
"VisitMutGenerator"
stringify!(VisitMutGenerator)
}

fn generate(&mut self, ctx: &CodegenCtx) -> GeneratorOutput {
Expand Down

0 comments on commit 8685932

Please sign in to comment.