Skip to content

Commit 74b93b5

Browse files
Separate parsing RustQt blocks, like we do with C++Qt
- Refactor parsing steps to be more readable - Refactor tests to be better separated
1 parent a2695b9 commit 74b93b5

File tree

11 files changed

+439
-429
lines changed

11 files changed

+439
-429
lines changed

crates/cxx-qt-gen/src/generator/rust/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl GeneratedRustBlocks {
104104
fn add_qobject_import(cxx_qt_data: &ParsedCxxQtData) -> Option<GeneratedRustFragment> {
105105
let includes = cxx_qt_data
106106
.qobjects()
107+
.iter()
107108
.any(|obj| obj.has_qobject_macro && obj.base_class.is_none());
108109
if includes
109110
|| cxx_qt_data

crates/cxx-qt-gen/src/generator/structuring/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ impl<'a> Structures<'a> {
8080
pub fn new(cxxqtdata: &'a ParsedCxxQtData) -> Result<Self> {
8181
let mut qobjects: Vec<_> = cxxqtdata
8282
.qobjects()
83+
.into_iter()
8384
.map(StructuredQObject::from_qobject)
8485
.collect();
8586

crates/cxx-qt-gen/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
mod generator;
1212
mod naming;
1313
mod parser;
14-
mod preprocessor;
14+
mod shorthand;
1515
mod syntax;
1616
mod writer;
1717

@@ -21,7 +21,7 @@ pub use generator::{
2121
GeneratedOpt,
2222
};
2323
pub use parser::Parser;
24-
pub use preprocessor::self_inlining::qualify_self_types;
24+
pub use shorthand::self_inlining;
2525
pub use syntax::{parse_qt_file, CxxQtFile, CxxQtItem};
2626
pub use writer::{cpp::write_cpp, rust::write_rust};
2727

@@ -89,6 +89,7 @@ mod tests {
8989
}
9090
}
9191
pub(crate) use assert_parse_errors;
92+
use crate::self_inlining::qualify_self_types;
9293

9394
/// Helper for formating C++ code
9495
pub(crate) fn format_cpp(cpp_code: &str) -> String {

0 commit comments

Comments
 (0)