summaryrefslogtreecommitdiff
path: root/src/eval/func.rs
diff options
context:
space:
mode:
authorMarmare314 <49279081+Marmare314@users.noreply.github.com>2023-04-20 11:05:11 +0200
committerGitHub <noreply@github.com>2023-04-20 11:05:11 +0200
commit4524539c2bc5f3a9f53bc57a1902264fc894969b (patch)
tree578dcc6b82b0d40d88eb5d6a6f07cbdc38ef10d0 /src/eval/func.rs
parentc505a0f5dccd120d97926f6ff5bbe0becf783aeb (diff)
forbid underscore as identifier closes #513 (#837)
Diffstat (limited to 'src/eval/func.rs')
-rw-r--r--src/eval/func.rs5
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>()?;
+ }
}
}