viewer: use the new Compiler API and add a --component command line arg

This commit is contained in:
Olivier Goffart 2024-07-03 16:49:22 +02:00 committed by GitHub
parent 875d20f1ac
commit 708ab9f7c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 70 additions and 27 deletions

View file

@ -248,9 +248,9 @@ impl Document {
self.exports
.iter()
.filter_map(|e| Some((&e.0.name_ident, e.1.as_ref().left()?)))
.filter(|(_, c)| !c.is_global())
.max_by_key(|(n, _)| n.text_range().end())
.map(|(_, c)| c.clone())
.or_else(|| self.exported_roots().last())
}
/// visit all root and used component (including globals)