flan/test/syntax/chain/macro.fln

17 lines
404 B
Plaintext

;;;; A chain in a macro's template, converted to parens: the names it binds
;;;; must not capture the caller's, which here are the ones the converter
;;;; would otherwise pick.
defmacro(between, [lo x hi]):
quote
~lo <= ~x < ~hi
fn main() -> i32
let mid = 1
let mid2 = 2
let mid3 = 3
println(between(mid, 5, mid))
println(between(0, mid2, mid3))
println(between(mid3, mid2, mid))
0