mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Make none
spreadable
This commit is contained in:
parent
c0f5cd011f
commit
f4ed775df0
@ -412,6 +412,7 @@ impl Eval for CallArgs {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
CallArg::Spread(expr) => match expr.eval(ctx)? {
|
CallArg::Spread(expr) => match expr.eval(ctx)? {
|
||||||
|
Value::None => {}
|
||||||
Value::Array(array) => {
|
Value::Array(array) => {
|
||||||
items.extend(array.into_iter().map(|value| Arg {
|
items.extend(array.into_iter().map(|value| Arg {
|
||||||
span,
|
span,
|
||||||
|
@ -50,6 +50,13 @@
|
|||||||
test(tostr(a: 1, ..more, b: 2), "(a: 1, c: 3, d: 4, b: 2)")
|
test(tostr(a: 1, ..more, b: 2), "(a: 1, c: 3, d: 4, b: 2)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
// None is spreadable.
|
||||||
|
#let f() = none
|
||||||
|
#f(..none)
|
||||||
|
#f(..if false {})
|
||||||
|
#f(..for x in () [])
|
||||||
|
|
||||||
---
|
---
|
||||||
// Error: 8-14 cannot spread string
|
// Error: 8-14 cannot spread string
|
||||||
#min(.."nope")
|
#min(.."nope")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user