summaryrefslogtreecommitdiffstats
path: root/crates/rebel-lang/src/scope.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-29 00:36:04 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-29 00:36:04 +0200
commit68a85fcf5e3b7e1bee56d68d4c5c587bb1aaccf6 (patch)
treec45a110a6e3f7f41464c355a5574d0ffdfed2749 /crates/rebel-lang/src/scope.rs
parentcee9711ba84e3c7ed8e45bd8364100955cf2b4e0 (diff)
downloadrebel-68a85fcf5e3b7e1bee56d68d4c5c587bb1aaccf6.tar
rebel-68a85fcf5e3b7e1bee56d68d4c5c587bb1aaccf6.zip
rebel-parse: replace TypedExpr with TypedPat
Diffstat (limited to 'crates/rebel-lang/src/scope.rs')
-rw-r--r--crates/rebel-lang/src/scope.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/crates/rebel-lang/src/scope.rs b/crates/rebel-lang/src/scope.rs
index 4df0909..e935a07 100644
--- a/crates/rebel-lang/src/scope.rs
+++ b/crates/rebel-lang/src/scope.rs
@@ -1,6 +1,6 @@
use std::{collections::HashMap, ops::Deref};
-use rebel_parse::ast::{self, expr};
+use rebel_parse::ast::{self, pat};
use crate::{
func::Func,
@@ -28,16 +28,10 @@ impl Context {
let typ = Type::ast_expr_type(self, expr)?;
// TODO: Handle explicit type
- let ast::TypedExpr {
- expr: dest_expr,
- typ: _,
- } = dest.deref();
+ let ast::TypedPat { pat, typ: _ } = dest.deref();
// TODO: Handle other assignable expressions
- let dest_path = match dest_expr {
- expr::Expr::Path(path) => path,
- _ => return Err(TypeError),
- };
+ let pat::Pat::Path(dest_path) = pat;
let [dest_ident] = dest_path.components[..] else {
return Err(TypeError);
};
@@ -66,16 +60,10 @@ impl Context {
let typ = value.typ().or(Err(EvalError))?;
// TODO: Handle explicit type
- let ast::TypedExpr {
- expr: dest_expr,
- typ: _,
- } = dest.deref();
+ let ast::TypedPat { pat, typ: _ } = dest.deref();
// TODO: Handle other assignable expressions
- let dest_path = match dest_expr {
- expr::Expr::Path(path) => path,
- _ => return Err(EvalError),
- };
+ let pat::Pat::Path(dest_path) = pat;
let [dest_ident] = dest_path.components[..] else {
return Err(EvalError);
};