From 0cb398bcd9db34d97c44d928c88641f08a88dd85 Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Fri, 4 Sep 2026 03:39:00 -0500 Subject: [PATCH] =?UTF-8?q?merge=20follow-up:=20=C2=A734's=20port=20walker?= =?UTF-8?q?s=20read=20ANSI=20port=20lists=20through=20ListElem::ok=20(?= =?UTF-8?q?=C2=A732's=20error=20elements)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- crates/vlog_linter/src/decls.rs | 2 +- crates/vlog_linter/src/module_decls.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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(),