correctly handle hdl byte literal suffixes
This commit is contained in:
parent
c2e5ea8e89
commit
63fd038729
|
@ -1392,13 +1392,16 @@ impl Visitor {
|
|||
fn process_literal(&mut self, literal: ExprLit) -> Expr {
|
||||
let ExprLit { attrs, lit } = literal;
|
||||
match &lit {
|
||||
Lit::Byte(lit_byte) if lit_byte.suffix() == "hdl" => {
|
||||
if let Some(retval) = self.process_int_literal(
|
||||
lit_byte.span(),
|
||||
&lit_byte.value().to_string(),
|
||||
"hdl_u8",
|
||||
) {
|
||||
return retval;
|
||||
Lit::Byte(lit_byte) => {
|
||||
let trimmed_suffix = lit_byte.suffix().trim_start_matches('_');
|
||||
if trimmed_suffix == "hdl" || trimmed_suffix == "hdl_u8" {
|
||||
if let Some(retval) = self.process_int_literal(
|
||||
lit_byte.span(),
|
||||
&lit_byte.value().to_string(),
|
||||
"hdl_u8",
|
||||
) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
Lit::Int(lit_int) => {
|
||||
|
|
|
@ -57,7 +57,7 @@ pub fn my_module(width: usize) {
|
|||
m.connect(
|
||||
o,
|
||||
#[hdl]
|
||||
[r, r, 13_hdl_u8],
|
||||
[r, r, b'\r'_hdl],
|
||||
);
|
||||
m.connect(o[1], 30_hdl_u8);
|
||||
m.connect(o2, i2);
|
||||
|
|
Loading…
Reference in a new issue