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/mod.rs | |
| parent | c505a0f5dccd120d97926f6ff5bbe0becf783aeb (diff) | |
forbid underscore as identifier closes #513 (#837)
Diffstat (limited to 'src/eval/mod.rs')
| -rw-r--r-- | src/eval/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 797e1fef..0a963faf 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -1160,6 +1160,7 @@ impl Eval for ast::Closure { params.push(Param::Named(named.name(), named.expr().eval(vm)?)); } ast::Param::Sink(name) => params.push(Param::Sink(name)), + ast::Param::Placeholder => params.push(Param::Placeholder), } } @@ -1184,6 +1185,7 @@ impl ast::Pattern { vm.define(ident.clone(), value); Ok(Value::None) } + ast::Pattern::Placeholder => Ok(Value::None), ast::Pattern::Destructuring(destruct) => { match value { Value::Array(value) => { @@ -1215,6 +1217,7 @@ impl ast::Pattern { "cannot destructure named elements from an array" ) } + ast::DestructuringKind::Placeholder => i += 1, } } if i < value.len() { @@ -1243,6 +1246,7 @@ impl ast::Pattern { vm.define(ident.clone(), v.clone()); used.insert(key.clone().take()); } + ast::DestructuringKind::Placeholder => {} } } |
