diff --git a/crates/vlog_linter/src/decls.rs b/crates/vlog_linter/src/decls.rs index d4d090c..a1f4f00 100644 --- a/crates/vlog_linter/src/decls.rs +++ b/crates/vlog_linter/src/decls.rs @@ -177,7 +177,7 @@ pub(crate) fn walk_declared_types(file: &SourceFile, f: &mut dyn FnMut(&Declared walk_items(file, &mut |item| match &item.kind { ItemKind::Module(module) => { if let vlog_parser::ast::PortList::Ansi(ports) = &module.ports { - for port in ports { + for port in ports.iter().filter_map(ListElem::ok) { declared(&port.ty, &port.name, port.name_span, false, f); } } diff --git a/crates/vlog_linter/src/module_decls.rs b/crates/vlog_linter/src/module_decls.rs index d79fcd7..732835a 100644 --- a/crates/vlog_linter/src/module_decls.rs +++ b/crates/vlog_linter/src/module_decls.rs @@ -9,7 +9,9 @@ //! `decls` (types and dimensions), so each of the three files stays one //! sentence long. -use vlog_parser::ast::{AnsiPort, GenBlock, GenElse, Item, ItemKind, PortList, SourceFile}; +use vlog_parser::ast::{ + AnsiPort, GenBlock, GenElse, Item, ItemKind, ListElem, PortList, SourceFile, +}; use vlog_parser::span::TextRange; /// One net, variable or port a module declares. @@ -127,7 +129,7 @@ fn header_ports(ports: &PortList, out: &mut Vec) { // A port with no direction keyword continues the previous one, as // the language says; a first port with none is `inout` by default. let mut carried: Option = None; - for port in ports { + for port in ports.iter().filter_map(ListElem::ok) { carried = direction(port).or(carried); out.push(SignalDecl { name: port.name.clone(),