summaryrefslogtreecommitdiff
path: root/src/eval/func.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval/func.rs')
-rw-r--r--src/eval/func.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/eval/func.rs b/src/eval/func.rs
index 9a8a9c94..128509f8 100644
--- a/src/eval/func.rs
+++ b/src/eval/func.rs
@@ -167,6 +167,21 @@ pub struct Arg {
}
impl Args {
+ /// Create positional arguments from a span and values.
+ pub fn from_values(span: Span, values: impl IntoIterator<Item = Value>) -> Self {
+ Self {
+ span,
+ items: values
+ .into_iter()
+ .map(|value| Arg {
+ span,
+ name: None,
+ value: Spanned::new(value, span),
+ })
+ .collect(),
+ }
+ }
+
/// Consume and cast the first positional argument.
///
/// Returns a `missing argument: {what}` error if no positional argument is