Skip to content

Commit

Permalink
Add first draft public API to navigate the design
Browse files Browse the repository at this point in the history
  • Loading branch information
kraigher committed Nov 21, 2023
1 parent 33f6388 commit 3c9a20c
Show file tree
Hide file tree
Showing 4 changed files with 411 additions and 1 deletion.
3 changes: 3 additions & 0 deletions vhdl_lang/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ mod standard;
mod static_expression;
mod target;

// @TODO consider moving facade into analysis
pub(crate) use {lock::ReadGuard, root::AnalysisData};

#[cfg(test)]
pub(crate) mod tests;
pub(crate) use root::{Library, LockedUnit};
Expand Down
3 changes: 2 additions & 1 deletion vhdl_lang/src/analysis/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ impl Library {
})
}

// @TODO optimize O() complexity
pub(crate) fn secondary_units<'a>(
&'a self,
primary: &'a Symbol,
) -> impl Iterator<Item = &'a LockedUnit> {
) -> impl Iterator<Item = &'a LockedUnit> + 'a {
self.units.iter().filter_map(move |(key, value)| match key {
UnitKey::Secondary(sym, _) if primary == sym => Some(value),
_ => None,
Expand Down
Loading

0 comments on commit 3c9a20c

Please sign in to comment.