core: Simplify & support non-ident common strings#23479
core: Simplify & support non-ident common strings#23479kjarosh wants to merge 3 commits intoruffle-rs:masterfrom
Conversation
|
I'm not a fan of how this moves the actual |
Doesn't it make more sense for the structure to be defined in the same file it's used? I think it makes more sense for |
|
Well, ideally
With your changes, the declaration also get split: e.g. Sure, this could be fixed by moving the entirety of the |
I'm not convinced that's the case, the structure and its usage will be in the same file anyway. I think we can just more the existing code as-is before the
In what way? I didn't notice anything particularly bad. |
This replaces the `define_common_strings!` macro-rules with a procedural macro that automatically generates field names from the provided byte string literals. This reduces duplication in `common.rs` by removing the need to manually specify `str_` prefixes for every common string.
After refactoring `define_common_strings!` to a proc macro, we can escape non-ident characters in strings and generate identifiers dynamically. This makes it possible to use any string as common string.
Add more common strings that weren't added previously due to the fact that common strings didn't support non-ident strings.
|
A "go-to" definition on the |
This PR replaces the
define_common_strings!macro-rules with a procedural macro that automatically generates field names from the provided byte string literals. This reduces duplication incommon.rsby removing the need to manually specifystr_prefixes for every common string.After refactoring
define_common_strings!to a proc macro, we can escape non-ident characters in strings and generate identifiers dynamically. This makes it possible to use any string as common string.Finally, the PR adds more common strings that weren't added previously due to the fact that common strings didn't support non-ident strings.