Skip to content

Commit

Permalink
More Refactor disconnect, package body and package declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris44442 committed Jun 3, 2024
1 parent 7416d11 commit ab2bee2
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 184 deletions.
4 changes: 2 additions & 2 deletions vhdl_lang/src/analysis/tests/declarations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2023, Olof Kraigher [email protected]
use crate::analysis::tests::{check_diagnostics, LibraryBuilder};
use crate::analysis::tests::{check_diagnostics, check_no_diagnostics, LibraryBuilder};
use crate::data::error_codes::ErrorCode;
use crate::Diagnostic;

Expand Down Expand Up @@ -116,7 +116,7 @@ begin
end arch;
",
);
check_diagnostics(builder.analyze(), vec![])
check_no_diagnostics(&builder.analyze())
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion vhdl_lang/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ pub struct ConfigurationSpecification {
pub enum GuardedSignalList {
All,
Others,
Ident(WithDecl<Ident>)
Ident(WithDecl<Vec<Ident>>),
}

/// LRM 7.4 Disconnection specification
Expand Down
6 changes: 1 addition & 5 deletions vhdl_lang/src/ast/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,11 +1142,7 @@ impl Display for ConfigurationDeclaration {

impl Display for DisconnectionSpecification {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
if let Some(ident) = &self.ident {
write!(f, "disconnection {}", ident)
} else {
write!(f, "disconnection")
}
write!(f, "disconnection")
}
}

Expand Down
13 changes: 8 additions & 5 deletions vhdl_lang/src/named_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use crate::ast::{
AliasDeclaration, AnyDesignUnit, AnyPrimaryUnit, AnySecondaryUnit, Attribute,
AttributeDeclaration, AttributeSpecification, ComponentDeclaration, Declaration, Designator,
DisconnectionSpecification, FileDeclaration, HasIdent, Ident, InterfaceFileDeclaration,
InterfacePackageDeclaration, ModeViewDeclaration, ObjectClass, ObjectDeclaration, PackageBody,
PackageDeclaration, PackageInstantiation, SubprogramBody, SubprogramInstantiation,
SubprogramSpecification, TypeDeclaration, WithDecl,
DisconnectionSpecification, FileDeclaration, GuardedSignalList, HasIdent, Ident,
InterfaceFileDeclaration, InterfacePackageDeclaration, ModeViewDeclaration, ObjectClass,
ObjectDeclaration, PackageBody, PackageDeclaration, PackageInstantiation, SubprogramBody,
SubprogramInstantiation, SubprogramSpecification, TypeDeclaration, WithDecl,
};
use crate::ast::{ExternalObjectClass, InterfaceDeclaration, InterfaceObjectDeclaration};
use crate::data::*;
Expand Down Expand Up @@ -662,7 +662,10 @@ impl HasEntityId for PackageDeclaration {

impl HasEntityId for DisconnectionSpecification {
fn ent_id(&self) -> Option<EntityId> {
self.ident.as_ref().and_then(|ident| ident.decl.get())
match &self.ident {
GuardedSignalList::Ident(with_decl) => with_decl.decl.get(),
_ => None,
}
}
}

Expand Down
Loading

0 comments on commit ab2bee2

Please sign in to comment.