module item traversals visit items with attributes

This commit is contained in:
Zachary Snow 2019-09-15 16:56:55 -04:00
parent 77b9d2f085
commit bb2a8febea
3 changed files with 16 additions and 0 deletions

View File

@ -128,6 +128,8 @@ traverseModuleItemsM mapper (Part extern kw lifetime name ports items) = do
mapM fullGenItemMapper genItems >>= mapper . Generate
fullMapper (Generate genItems) =
mapM fullGenItemMapper genItems >>= mapper . Generate
fullMapper (MIAttr attr mi) =
fullMapper mi >>= return . MIAttr attr
fullMapper other = mapper other
fullGenItemMapper = traverseNestedGenItemsM genItemMapper
genItemMapper (GenModuleItem moduleItem) = do

7
test/basic/attr.sv Normal file
View File

@ -0,0 +1,7 @@
module top;
(* foo="bar" *) logic x;
initial begin
x = 1;
$display(x);
end
endmodule

7
test/basic/attr.v Normal file
View File

@ -0,0 +1,7 @@
module top;
(* foo="bar" *) reg x;
initial begin
x = 1;
$display(x);
end
endmodule