summaryrefslogtreecommitdiffstats
path: root/crates/rebel-lang/examples/repl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-lang/examples/repl.rs')
-rw-r--r--crates/rebel-lang/examples/repl.rs35
1 files changed, 7 insertions, 28 deletions
diff --git a/crates/rebel-lang/examples/repl.rs b/crates/rebel-lang/examples/repl.rs
index 914f318..db82ba6 100644
--- a/crates/rebel-lang/examples/repl.rs
+++ b/crates/rebel-lang/examples/repl.rs
@@ -85,34 +85,13 @@ fn main() {
}
};
- match stmt.validate() {
- Ok(()) => (),
- Err(err) => {
- println!("Validation error: {err:?}");
- continue;
- }
- };
-
- match &stmt {
- rebel_parse::ast::BodyStmt::Assign { dest: _, expr } => {
- match Type::ast_expr_type(&ctx, expr) {
- Ok(_) => (),
- Err(err) => {
- println!("Type error: {err:?}");
- continue;
- }
- };
- }
- rebel_parse::ast::BodyStmt::Expr { expr } => {
- match Type::ast_expr_type(&ctx, expr) {
- Ok(_) => (),
- Err(err) => {
- println!("Type error: {err:?}");
- continue;
- }
- };
- }
- rebel_parse::ast::BodyStmt::Empty => {}
+ if let Err(err) = stmt.validate() {
+ println!("Validation error: {err:?}");
+ continue;
+ }
+ if let Err(err) = Type::ast_stmt_type(&ctx, &stmt) {
+ println!("Type error: {err:?}");
+ continue;
}
let value = match ctx.run(&stmt) {