Skip to content
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
6 changes: 3 additions & 3 deletions tasks/ast_tools/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ pub enum GeneratorOrDerive {

impl GeneratorOrDerive {
/// Execute `prepare` method on the [`Generator`] or [`Derive`].
pub fn prepare(self, schema: &mut Schema) {
pub fn prepare(self, schema: &mut Schema, codegen: &Codegen) {
match self {
Self::Generator(generator) => generator.prepare(schema),
Self::Derive(derive) => derive.prepare(schema),
Self::Generator(generator) => generator.prepare(schema, codegen),
Self::Derive(derive) => derive.prepare(schema, codegen),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/derives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub trait Derive: Runner {
///
/// Runs before any `generate` or `derive` method runs.
#[expect(unused_variables)]
fn prepare(&self, schema: &mut Schema) {}
fn prepare(&self, schema: &mut Schema, codegen: &Codegen) {}

/// Generate trait implementation for a type.
fn derive(&self, type_def: StructOrEnum<'_>, schema: &Schema) -> TokenStream;
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/generators/assert_layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ define_generator!(AssertLayouts);

impl Generator for AssertLayouts {
/// Calculate layouts of all types.
fn prepare(&self, schema: &mut Schema) {
fn prepare(&self, schema: &mut Schema, _codegen: &Codegen) {
for type_id in schema.types.indices() {
calculate_layout(type_id, schema);
}
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/generators/ast_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ define_generator!(AstKindGenerator);

impl Generator for AstKindGenerator {
/// Set `has_kind` for structs and enums which are visited, and not on blacklist.
fn prepare(&self, schema: &mut Schema) {
fn prepare(&self, schema: &mut Schema, _codegen: &Codegen) {
// Set `has_kind` to `true` for all visited types
for type_def in &mut schema.types {
match type_def {
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub trait Generator: Runner {
///
/// Runs before any `generate` or `derive` method runs.
#[expect(unused_variables)]
fn prepare(&self, schema: &mut Schema) {}
fn prepare(&self, schema: &mut Schema, codegen: &Codegen) {}

/// Generate single output.
#[expect(unused_variables, clippy::unimplemented)]
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/generators/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Generator for VisitGenerator {

/// Create names for `visit_*` methods and `walk_*` functions for all `Vec`s
/// whose inner type has a visitor.
fn prepare(&self, schema: &mut Schema) {
fn prepare(&self, schema: &mut Schema, _codegen: &Codegen) {
for type_id in schema.types.indices() {
let Some(vec_def) = schema.types[type_id].as_vec() else { continue };

Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ fn main() {
// Run `prepare` actions
let runners = get_runners();
for runner in &runners {
runner.prepare(&mut schema);
runner.prepare(&mut schema, &codegen);
}

// Run generators
Expand Down
Loading