Skip to content
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

Refactor ParsedMethod, ParsedSignal and ParsedInheritedMethod #1054

Merged
merged 9 commits into from
Sep 2, 2024

Conversation

BenFordTytherington
Copy link
Collaborator

  • Refactor method and inherited method to have docs passthrough
  • Group common functionality between these 3 similar structs

…ike ParsedSignal

- ParsedSignal had a `docs: Vec<Attribute>` field, and it seemed appropriate to add this to method and inherited methods too
Is this the intended use?
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4e48578) to head (d9cc587).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1054   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           72        72           
  Lines        13009     13061   +52     
=========================================
+ Hits         13009     13061   +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…sedInheritedMethod

Includes introducing a struct and associated functions for the common fields, combining the common logic for parsing those fields.
Also adds methods to build those types from the InvokableFields struct
@BenFordTytherington
Copy link
Collaborator Author

Is it useful to combine all these invokable types in ParsedCxxQtData using trait objects and enum markers? or is it better to keep them separate for preserving order.
Something like invokables: BTreeMap<InvokableKind, Box<Vec<dyn Invokable>> might be too complex but could also combine lots of common logic?

….g. Function searches for non-inherited methods first
…to be refactored

- They now implement an Invokable trait which can be extended to improve shared functionality
- This allowed refactoring of method and signal lookup to use a common lookup function
@BenFordTytherington BenFordTytherington marked this pull request as ready for review August 30, 2024 16:16
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

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

The tests seem to not be up-to-date, but this is going in the right direction :)

crates/cxx-qt-gen/src/parser/mod.rs Outdated Show resolved Hide resolved
crates/cxx-qt-gen/src/parser/mod.rs Outdated Show resolved Hide resolved
- Moved MethodFields and its renamed method to method.rs
- Updated the expected outputs
- Refactor the lookup method to be generic, and remove the superfluous trait
@LeonMatthesKDAB LeonMatthesKDAB enabled auto-merge (squash) September 2, 2024 10:32
@LeonMatthesKDAB LeonMatthesKDAB merged commit 5762f3e into KDAB:main Sep 2, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants