Skip to content

Commit d6d87ee

Browse files
committed
accept more Local patterns in indirect function calls
1 parent f03feb6 commit d6d87ee

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/ir.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ mod tests {
350350
assert_eq!(super::local("%."), Ok(("", Local)));
351351

352352
assert_eq!(super::local("%.9"), Ok(("", Local)));
353+
354+
assert_eq!(super::local("%f"), Ok(("", Local)));
355+
356+
assert_eq!(super::local("%_17.0.i.i.i.i.i"), Ok(("", Local)));
353357
}
354358

355359
#[test]

src/ir/define.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,7 @@ fn indirect_call(i: &str) -> IResult<&str, Stmt> {
228228
.0;
229229
let (i, output) = alt((map(super::type_, Some), map(tag("void"), |_| None)))(i)?;
230230
let i = space1(i)?.0;
231-
let i = char('%')(i)?.0;
232-
let i = opt(char('_'))(i)?.0;
233-
let i = digit1(i)?.0;
234-
let i = many0(|i| tag(".i")(i))(i)?.0;
231+
let i = super::local(i)?.0;
235232
let (i, inputs) = delimited(
236233
char('('),
237234
separated_list(
@@ -517,6 +514,20 @@ mod tests {
517514
);
518515
}
519516

517+
#[test]
518+
fn call_gh58() {
519+
assert_eq!(
520+
super::indirect_call("tail call void %f()"),
521+
Ok((
522+
"",
523+
Stmt::IndirectCall(FnSig {
524+
inputs: vec![],
525+
output: None,
526+
})
527+
))
528+
);
529+
}
530+
520531
#[test]
521532
fn label() {
522533
assert_eq!(

0 commit comments

Comments
 (0)