Skip to content

Split VariantBuilder into separate builders depending on type#50

Merged
Bergmann89 merged 6 commits intoBergmann89:xsd-toolboxfrom
lukasfri:feat/simplified-interpreter
May 9, 2025
Merged

Split VariantBuilder into separate builders depending on type#50
Bergmann89 merged 6 commits intoBergmann89:xsd-toolboxfrom
lukasfri:feat/simplified-interpreter

Conversation

@lukasfri
Copy link
Copy Markdown

This PR took a lot of work but now successfully passes all tests. It depends on #43 .

@lukasfri
Copy link
Copy Markdown
Author

@Bergmann89 I still appear to require workflow approval for every PR.

@lukasfri
Copy link
Copy Markdown
Author

I will note that this also simplifies the handling of simpleContent massively. Instead of being self-contained now, it instead defers to a SimpleType sub-builder for the content, which considerably decreases complexity.

@Bergmann89
Copy link
Copy Markdown
Owner

You have to get your first PR merged, before github automatically start the checks on new PRs.

I didn't had a look to this PR yet, I want to merge the other one before I start review on this one.

@lukasfri
Copy link
Copy Markdown
Author

lukasfri commented May 2, 2025

@Bergmann89 Any requests you have before you review?

@lukasfri lukasfri changed the base branch from master to xsd-toolbox May 2, 2025 08:39
Copy link
Copy Markdown
Owner

@Bergmann89 Bergmann89 left a comment

Choose a reason for hiding this comment

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

Just a few small remarks, but overall it looks really good to me — much cleaner than before. Sometimes it really helps to have someone else look at the code and pull you out of your own head! 😄

Comment thread src/interpreter/builders/attribute_type.rs Outdated
/* any type */

/// Initialize the type of a `$builder` to any type `$variant`.
macro_rules! init_any {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

These two macros are now duplicated for each builder. Could we move them to a utils/common module or just into builder/mod.rs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'd personally like to get rid of the macros all together. Speaking personally, they confused the hell out of me, and I see no benefit compared to simply using functions with #[inline].

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It was simpler to use a macro for this (especially since it was even more complex in an earlier implementation). We can also replace it with a regular function. So, we either add that function now or move the macros into mod.rs. In my opinion, leaving the code duplicated is not an option.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've rewritten it to have functions now. I'm not sure I'm 100% happy with it, but I like it better than the macros.

Comment thread src/interpreter/builders/attribute_type.rs Outdated
Comment thread src/interpreter/builders/simple_type.rs Outdated
Comment thread src/interpreter/name_builder.rs Outdated
Comment thread src/interpreter/schema.rs Outdated
@Bergmann89 Bergmann89 changed the title feat(interpreter): Split VariantBuilder into separate builders depending on type Split VariantBuilder into separate builders depending on type May 8, 2025
@lukasfri lukasfri requested a review from Bergmann89 May 9, 2025 11:55
@Bergmann89 Bergmann89 merged commit d65c1df into Bergmann89:xsd-toolbox May 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants