Skip to content

Commit ab2bee2

Browse files
committed
More Refactor disconnect, package body and package declaration
1 parent 7416d11 commit ab2bee2

File tree

5 files changed

+170
-184
lines changed

5 files changed

+170
-184
lines changed

vhdl_lang/src/analysis/tests/declarations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// You can obtain one at http://mozilla.org/MPL/2.0/.
44
//
55
// Copyright (c) 2023, Olof Kraigher [email protected]
6-
use crate::analysis::tests::{check_diagnostics, LibraryBuilder};
6+
use crate::analysis::tests::{check_diagnostics, check_no_diagnostics, LibraryBuilder};
77
use crate::data::error_codes::ErrorCode;
88
use crate::Diagnostic;
99

@@ -116,7 +116,7 @@ begin
116116
end arch;
117117
",
118118
);
119-
check_diagnostics(builder.analyze(), vec![])
119+
check_no_diagnostics(&builder.analyze())
120120
}
121121

122122
#[test]

vhdl_lang/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ pub struct ConfigurationSpecification {
13831383
pub enum GuardedSignalList {
13841384
All,
13851385
Others,
1386-
Ident(WithDecl<Ident>)
1386+
Ident(WithDecl<Vec<Ident>>),
13871387
}
13881388

13891389
/// LRM 7.4 Disconnection specification

vhdl_lang/src/ast/display.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,11 +1142,7 @@ impl Display for ConfigurationDeclaration {
11421142

11431143
impl Display for DisconnectionSpecification {
11441144
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
1145-
if let Some(ident) = &self.ident {
1146-
write!(f, "disconnection {}", ident)
1147-
} else {
1148-
write!(f, "disconnection")
1149-
}
1145+
write!(f, "disconnection")
11501146
}
11511147
}
11521148

vhdl_lang/src/named_entity.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
use crate::ast::{
88
AliasDeclaration, AnyDesignUnit, AnyPrimaryUnit, AnySecondaryUnit, Attribute,
99
AttributeDeclaration, AttributeSpecification, ComponentDeclaration, Declaration, Designator,
10-
DisconnectionSpecification, FileDeclaration, HasIdent, Ident, InterfaceFileDeclaration,
11-
InterfacePackageDeclaration, ModeViewDeclaration, ObjectClass, ObjectDeclaration, PackageBody,
12-
PackageDeclaration, PackageInstantiation, SubprogramBody, SubprogramInstantiation,
13-
SubprogramSpecification, TypeDeclaration, WithDecl,
10+
DisconnectionSpecification, FileDeclaration, GuardedSignalList, HasIdent, Ident,
11+
InterfaceFileDeclaration, InterfacePackageDeclaration, ModeViewDeclaration, ObjectClass,
12+
ObjectDeclaration, PackageBody, PackageDeclaration, PackageInstantiation, SubprogramBody,
13+
SubprogramInstantiation, SubprogramSpecification, TypeDeclaration, WithDecl,
1414
};
1515
use crate::ast::{ExternalObjectClass, InterfaceDeclaration, InterfaceObjectDeclaration};
1616
use crate::data::*;
@@ -662,7 +662,10 @@ impl HasEntityId for PackageDeclaration {
662662

663663
impl HasEntityId for DisconnectionSpecification {
664664
fn ent_id(&self) -> Option<EntityId> {
665-
self.ident.as_ref().and_then(|ident| ident.decl.get())
665+
match &self.ident {
666+
GuardedSignalList::Ident(with_decl) => with_decl.decl.get(),
667+
_ => None,
668+
}
666669
}
667670
}
668671

0 commit comments

Comments
 (0)