Skip to content

Commit

Permalink
compiler: don't call resolve_import_path twice
Browse files Browse the repository at this point in the history
`resolved_import` is only used for non .slint file.
For slint file, `ensure_document_loaded` will call
`resolve_import_path` again.
  • Loading branch information
ogoffart committed Nov 14, 2024
1 parent 65fb9d8 commit 0533fa4
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions internal/compiler/typeloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,20 +886,16 @@ impl TypeLoader {
let mut foreign_imports = vec![];
let mut dependencies_futures = vec![];
for mut import in Self::collect_dependencies(state, doc) {
let resolved_import = if let Some((path, _)) = state
.borrow()
.tl
.resolve_import_path(Some(&import.import_uri_token.clone().into()), &import.file)
{
path.to_string_lossy().to_string()
} else {
import.file.clone()
};
if !(resolved_import.ends_with(".slint")
|| resolved_import.ends_with(".60")
if !(import.file.ends_with(".slint")
|| import.file.ends_with(".60")
|| import.file.starts_with('@'))
{
import.file = resolved_import;
if let Some((path, _)) = state.borrow().tl.resolve_import_path(
Some(&import.import_uri_token.clone().into()),
&import.file,
) {
import.file = path.to_string_lossy().into_owned();
};
foreign_imports.push(import);
continue;
}
Expand Down

0 comments on commit 0533fa4

Please sign in to comment.