diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-02-07 13:39:05 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-02-07 13:39:05 +0100 |
| commit | e35bbfffcb1f84b2fb0679759152ca0a5eabfad4 (patch) | |
| tree | 28123506b60be4e90ec611f8f3f9bb0ab5bec2f6 /src/eval/mod.rs | |
| parent | 062d99f70fe5eed0fbc81182565b51360495e465 (diff) | |
Remove captured expression 🗑️
Diffstat (limited to 'src/eval/mod.rs')
| -rw-r--r-- | src/eval/mod.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index cfd1c808..e49f7779 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -194,7 +194,6 @@ impl Eval for Spanned<&Expr> { Expr::Let(v) => v.with_span(self.span).eval(ctx), Expr::If(v) => v.with_span(self.span).eval(ctx), Expr::For(v) => v.with_span(self.span).eval(ctx), - Expr::Captured(v) => v.borrow().clone(), } } } @@ -344,21 +343,17 @@ impl Spanned<&ExprBinary> { let rhs = self.v.rhs.eval(ctx); let span = self.v.lhs.span; - let slot = match &self.v.lhs.v { - Expr::Ident(id) => match ctx.scopes.get(id) { + let slot = if let Expr::Ident(id) = &self.v.lhs.v { + match ctx.scopes.get(id) { Some(slot) => slot, None => { ctx.diag(error!(span, "unknown variable")); return Value::Error; } - }, - - Expr::Captured(slot) => slot, - - _ => { - ctx.diag(error!(span, "cannot assign to this expression")); - return Value::Error; } + } else { + ctx.diag(error!(span, "cannot assign to this expression")); + return Value::Error; }; let (constant, err, value) = if let Ok(mut inner) = slot.try_borrow_mut() { |
