What originally started as a refactor of naming (see #835 ) has now become a plan for a larger internal refactoring, which we aim to be the baseline of the next 0.7 release.
From this improved, cleaner architecture, we should be able to stabilize more easily and quickly.
The planned structure of cxx-qt-gen:
Frontend (Parser)
Parsing
This phase should parse the syn tree into a list of declarations with all attributes resolved into usable data formats.
However, all items should remain independent from each other and remain close to the way the user wrote it. (new :star2: )
The result should be a list of extern blocks, each with a list of items, like QObject declarations, QEnum declarations, etc.
Type Name extraction (the "Naming phase") (new :star2: )
Extracts all nameable types out of the parsed data.
This is useful to resolve references and renamed types in the generation phase.
Checks phase??? (new :star2: )
We also consider adding a separate phase for certain checks. Though it's not yet clear what should belong there and what not.
Rust Backend
Generation
We assume that for Rust code generation, most things can stay independent.
Therefore we should be able to directly generate the Rust code from the input declarations without having to rearrange and associate more complex items like QObjects.
Writer
C++ Backend
Structuring (new :star2: )
C++ headers need to be structured, as all data within a QObject must be written inside the same pair of {...}.
Therefore we need to associate the loosely parsed data from the Frontend.
This should now be its own phase
Generation
Writer
Overall we should use the new functions from the naming module wherever possible, which should then solve our issues regarding cxx_name, rust_name, etc.
What originally started as a refactor of naming (see #835 ) has now become a plan for a larger internal refactoring, which we aim to be the baseline of the next 0.7 release. From this improved, cleaner architecture, we should be able to stabilize more easily and quickly.
The planned structure of cxx-qt-gen:
{...}
. Therefore we need to associate the loosely parsed data from the Frontend. This should now be its own phaseOverall we should use the new functions from the
naming
module wherever possible, which should then solve our issues regardingcxx_name
,rust_name
, etc.Associated issues: