diff options
| author | Marmare314 <49279081+Marmare314@users.noreply.github.com> | 2023-04-20 11:05:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-20 11:05:11 +0200 |
| commit | 4524539c2bc5f3a9f53bc57a1902264fc894969b (patch) | |
| tree | 578dcc6b82b0d40d88eb5d6a6f07cbdc38ef10d0 /src/eval/func.rs | |
| parent | c505a0f5dccd120d97926f6ff5bbe0becf783aeb (diff) | |
forbid underscore as identifier closes #513 (#837)
Diffstat (limited to 'src/eval/func.rs')
| -rw-r--r-- | src/eval/func.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/eval/func.rs b/src/eval/func.rs index faf2d696..29b85f7a 100644 --- a/src/eval/func.rs +++ b/src/eval/func.rs @@ -274,6 +274,8 @@ pub enum Param { Named(Ident, Value), /// An argument sink: `..args`. Sink(Option<Ident>), + /// A placeholder: `_`. + Placeholder, } impl Closure { @@ -334,6 +336,9 @@ impl Closure { args.named::<Value>(ident)?.unwrap_or_else(|| default.clone()); vm.define(ident.clone(), value); } + Param::Placeholder => { + args.eat::<Value>()?; + } } } |
