diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-03 15:58:15 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-03 15:58:15 +0200 |
| commit | d59109e8fffa1d0b03234329e12f5d3e578804e8 (patch) | |
| tree | fe7453da6f2ae327993e5ca6436ddc6a448a2c41 /src/eval/args.rs | |
| parent | f77f1f61bf05ae506689be3c40252c5807276280 (diff) | |
Support recursive show rules
Diffstat (limited to 'src/eval/args.rs')
| -rw-r--r-- | src/eval/args.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/eval/args.rs b/src/eval/args.rs index 40454ff5..f507e714 100644 --- a/src/eval/args.rs +++ b/src/eval/args.rs @@ -26,19 +26,22 @@ pub struct Arg { } impl Args { + /// Create empty arguments from a span. + pub fn new(span: Span) -> Self { + Self { span, items: vec![] } + } + /// 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(), - } + let items = values + .into_iter() + .map(|value| Arg { + span, + name: None, + value: Spanned::new(value, span), + }) + .collect(); + Self { span, items } } /// Consume and cast the first positional argument. |
