Skip to content

Commit c21cfac

Browse files
committed
Fix misspelled minimum
1 parent e2c2f29 commit c21cfac

File tree

7 files changed

+441
-427
lines changed

7 files changed

+441
-427
lines changed

vhdl_lang/src/analysis/analyze.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ impl<'a> AnalyzeContext<'a> {
206206
};
207207

208208
if let Some(std_library) = self.get_library(&self.std_sym) {
209-
// @TODO add warning for missing standard library
210209
region.make_potentially_visible(None, std_library);
211210

212211
let standard_pkg_data = self.expect_standard_package_analysis()?;

vhdl_lang/src/analysis/implicits.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,30 @@ impl ImplicitVec {
3434
pub fn iter(&self) -> impl Iterator<Item = Arc<NamedEntity>> + '_ {
3535
self.0.iter().filter_map(|weak_ent| weak_ent.upgrade())
3636
}
37+
38+
pub unsafe fn push(&self, ent: &Arc<NamedEntity>) {
39+
raw_mut(&self.0).push(Arc::downgrade(ent));
40+
}
3741
}
3842

3943
#[derive(Default)]
4044
pub struct ImplicitsBuilder<T>(Arc<T>);
4145

4246
impl<T> ImplicitsBuilder<T> {
43-
#[allow(clippy::mut_from_ref)]
44-
unsafe fn raw_mut(&self) -> &mut T {
45-
let ptr = self.0.as_ref() as *const T as *mut T;
46-
&mut *ptr
47-
}
48-
4947
pub fn inner(&self) -> Implicits<T> {
5048
Implicits(self.0.clone())
5149
}
5250
}
5351
impl ImplicitVecBuilder {
5452
pub fn push(&self, ent: &Arc<NamedEntity>) {
5553
unsafe {
56-
self.raw_mut().push(Arc::downgrade(ent));
54+
raw_mut(&self.0).push(Arc::downgrade(ent));
5755
}
5856
}
5957
}
58+
59+
#[allow(clippy::mut_from_ref)]
60+
unsafe fn raw_mut<T>(arc: &Arc<T>) -> &mut T {
61+
let ptr = arc.as_ref() as *const T as *mut T;
62+
&mut *ptr
63+
}

vhdl_lang/src/analysis/named_entity.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,24 @@ pub enum Type {
4343

4444
impl Type {
4545
pub fn implicit_declarations(&self) -> impl Iterator<Item = Arc<NamedEntity>> + '_ {
46+
self.implicits().into_iter().flat_map(|imp| imp.iter())
47+
}
48+
49+
pub fn implicits(&self) -> Option<&ImplicitVec> {
4650
match self {
47-
Type::Array { ref implicit, .. } => Some(implicit.iter()),
48-
Type::Enum(ref implicit, _) => Some(implicit.iter()),
49-
Type::Integer(ref implicit) => Some(implicit.iter()),
50-
Type::Physical(ref implicit) => Some(implicit.iter()),
51-
Type::File(ref implicit) => Some(implicit.iter()),
52-
Type::Access(.., ref implicit) => Some(implicit.iter()),
51+
Type::Array { ref implicit, .. } => Some(implicit),
52+
Type::Enum(ref implicit, _) => Some(implicit),
53+
Type::Integer(ref implicit) => Some(implicit),
54+
Type::Physical(ref implicit) => Some(implicit),
55+
Type::File(ref implicit) => Some(implicit),
56+
Type::Access(.., ref implicit) => Some(implicit),
5357
Type::Incomplete(..)
5458
| Type::Interface
5559
| Type::Protected(..)
5660
| Type::Record(..)
5761
| Type::Subtype(..)
5862
| Type::Alias(..) => None,
5963
}
60-
.into_iter()
61-
.flatten()
6264
}
6365

6466
pub fn describe(&self) -> &str {
@@ -541,7 +543,7 @@ impl std::cmp::PartialEq for NamedEntity {
541543
}
542544

543545
// A named entity that is known to be an object
544-
#[derive(Clone)]
546+
#[derive(Clone, Debug)]
545547
pub struct ObjectEnt {
546548
pub ent: Arc<NamedEntity>,
547549
}
@@ -582,7 +584,7 @@ impl ObjectEnt {
582584
}
583585

584586
// A named entity that is known to be a type
585-
#[derive(Clone)]
587+
#[derive(Clone, Debug)]
586588
pub struct TypeEnt(Arc<NamedEntity>);
587589

588590
impl TypeEnt {

vhdl_lang/src/analysis/names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::sync::Arc;
77
// Represent a resolved name which can be either a
88
// 1. NonObject such as a library or design unit
99
// 2. Object such a direct reference to an object or some kind of index, slice or selected name
10+
#[derive(Debug)]
1011
pub enum ResolvedName {
1112
NonObject(Arc<NamedEntity>),
1213
Type(TypeEnt),

0 commit comments

Comments
 (0)