Skip to content

Refactor item_name method to use ItemInfo struct #3129

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Prev Previous commit
cargo +nightly fmt
  • Loading branch information
twizmwazin committed Apr 15, 2025
commit b2000d79652bf34f5e3c2882e81235506a13dc6f
4 changes: 3 additions & 1 deletion bindgen/ir/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,9 @@ impl Item {
kind: match self.kind() {
ItemKind::Module(..) => crate::callbacks::ItemKind::Module,
ItemKind::Type(..) => crate::callbacks::ItemKind::Type,
ItemKind::Function(..) => crate::callbacks::ItemKind::Function,
ItemKind::Function(..) => {
crate::callbacks::ItemKind::Function
}
ItemKind::Var(..) => crate::callbacks::ItemKind::Var,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? There are no tests for this but reporting everything that isn't a function a Var seems totally wrong.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it isn't really correct. It looks like the ir ItemKind type has 4 variants, while the callback ItemKind type has only 2. Modules and Types are the variants missing, I'll add those to the callback enum so that they can be correctly handled.

};
Expand Down
Loading