mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
do blocks generate scope
This commit is contained in:
parent
e40fd15928
commit
cf3dccca2c
|
@ -74,7 +74,7 @@ impl Codegen {
|
|||
.collect::<Vec<_>>().
|
||||
join(", ");
|
||||
format!(
|
||||
"const f_{} = ({}): {} => {{\n{}\n}};\n",
|
||||
"const f_{} = ({}): {} => {};\n",
|
||||
name,
|
||||
args,
|
||||
return_type_hint,
|
||||
|
@ -90,10 +90,11 @@ impl Codegen {
|
|||
},
|
||||
|
||||
IRKind::Do { body } => {
|
||||
let mut out = String::new();
|
||||
let mut out = "{\n".to_string();
|
||||
for expr in body {
|
||||
out.push_str(&self.gen_ir(&expr, true));
|
||||
}
|
||||
out.push_str("}\n");
|
||||
out
|
||||
},
|
||||
|
||||
|
|
7
example/err/do_end_scope.hz
Normal file
7
example/err/do_end_scope.hz
Normal file
|
@ -0,0 +1,7 @@
|
|||
fun main: void = do
|
||||
do
|
||||
let foo: string = "Hello";
|
||||
@write(foo);
|
||||
end;
|
||||
@write(foo); -- TODO: This is a runtime error
|
||||
end;
|
Loading…
Reference in a new issue