Clean up internal Exports struct

- Use deref instead of `.0` tuple access (looks neater)
- Provide a convenience find() function that also makes use of the sorting
This commit is contained in:
Simon Hausmann 2022-12-01 21:16:16 +01:00 committed by Simon Hausmann
parent 6f19ab38e7
commit b38fe7c5f0
5 changed files with 13 additions and 18 deletions

View file

@ -10,7 +10,7 @@ use crate::object_tree::{Component, Document, PropertyVisibility};
pub fn check_public_api(doc: &Document, diag: &mut BuildDiagnostics) {
check_public_api_component(&doc.root_component, diag);
for (export_name, e) in &doc.exports.0 {
for (export_name, e) in &*doc.exports {
if let Some(c) = e.as_ref().left() {
if c.is_global() {
// This global will become part of the public API.

View file

@ -16,7 +16,7 @@ pub fn collect_globals(doc: &Document, _diag: &mut BuildDiagnostics) {
doc.root_component.used_types.borrow_mut().globals.clear();
let mut set = HashSet::new();
let mut sorted_globals = vec![];
for (_, ty) in &doc.exports.0 {
for (_, ty) in &*doc.exports {
if let Some(c) = ty.as_ref().left() {
if c.is_global() {
if set.insert(ByAddress(c.clone())) {