diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-04-29 23:00:53 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-04-29 23:00:53 +0200 |
commit | 2d68c8428cc4b7418bf8e556c8c3f430a4ec1211 (patch) | |
tree | 30e7d541b0f11eedf7e501c087cadd67ed58cd01 | |
parent | 25be199b19ed995e42fb2abe065b991f8c15d354 (diff) | |
download | rebel-2d68c8428cc4b7418bf8e556c8c3f430a4ec1211.tar rebel-2d68c8428cc4b7418bf8e556c8c3f430a4ec1211.zip |
rebel-lang: repl: use record_type() on a cloned Context instead of ast_stmt_type()
The whole typechecking will happen in record_type() to avoid duplicating
the logic.
-rw-r--r-- | crates/rebel-lang/examples/repl.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/rebel-lang/examples/repl.rs b/crates/rebel-lang/examples/repl.rs index b7b91ca..f2c714b 100644 --- a/crates/rebel-lang/examples/repl.rs +++ b/crates/rebel-lang/examples/repl.rs @@ -89,7 +89,9 @@ fn main() { println!("Validation error: {err:?}"); continue; } - if let Err(err) = Type::ast_stmt_type(&ctx, &stmt) { + + let mut typecheck_ctx = ctx.clone(); + if let Err(err) = typecheck_ctx.record_type(&stmt) { println!("Type error: {err:?}"); continue; } |