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

First stage of cleaning up the export handling of the slint root component #2095

Merged
merged 3 commits into from
Jan 23, 2023

Conversation

tronical
Copy link
Member

We implicitly export the last component of a .slint file to the generator. Issue a warning when that happens and suggest to export it explicitly.

@tronical tronical marked this pull request as draft January 20, 2023 17:11
@tronical
Copy link
Member Author

This needs more work.

}

diagnostics.all_loaded_files = loader.all_files().cloned().collect();

(doc, diagnostics)
(root_component, doc, diagnostics)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we return a root_component here instead of just using Document::root_component?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the root_component from the document because we use the document for each file but the root component concept only makes IMO sense for the component we generate code for / run. Perhaps eventually we'll remove it altogether and just go by exports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Besides feeling like a natural change, this also makes it easy to issue the warning only for the true root component, instead of for every Slint file. But if you prefer then I can try to solve that differently and restore root_component in Document.

@tronical tronical force-pushed the simon/export-warning branch from 0e154b2 to 3a3aa85 Compare January 23, 2023 11:04
@tronical
Copy link
Member Author

Implemented differently now, less invasive :)

@tronical tronical force-pushed the simon/export-warning branch from 3a3aa85 to 98b67ab Compare January 23, 2023 12:16
@tronical tronical marked this pull request as ready for review January 23, 2023 12:16
@tronical tronical force-pushed the simon/export-warning branch from 98b67ab to d8ec67e Compare January 23, 2023 12:17
…onent

We implicitly export the last component of a .slint file to the generator.
Issue a warning when that happens and suggest to export it explicitly.
@tronical tronical force-pushed the simon/export-warning branch from d8ec67e to ec64754 Compare January 23, 2023 12:20
These assert that no diagnostics are produced
Don't produce warnings
@tronical tronical merged commit 24dcef5 into master Jan 23, 2023
@tronical tronical deleted the simon/export-warning branch January 23, 2023 14:19
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