[fine] a note about a latent bug
This commit is contained in:
parent
f8f5c9bfac
commit
5c05077312
1 changed files with 16 additions and 0 deletions
|
|
@ -401,6 +401,22 @@ impl<'a> Semantics<'a> {
|
||||||
TreeKind::LetStatement => self.environment_of_let(parent, tree),
|
TreeKind::LetStatement => self.environment_of_let(parent, tree),
|
||||||
TreeKind::FunctionDecl => self.environment_of_func(parent, tree),
|
TreeKind::FunctionDecl => self.environment_of_func(parent, tree),
|
||||||
|
|
||||||
|
// TODO: Blocks should introduce a local environment if required.
|
||||||
|
// Test with a type error in a block statement and a
|
||||||
|
// binding outside. You will need a new assertion type and
|
||||||
|
// possibly a compile/run to ensure it works.
|
||||||
|
//
|
||||||
|
// let x = 7;
|
||||||
|
// {
|
||||||
|
// let x = 23;
|
||||||
|
// }
|
||||||
|
// print(x); // 7
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// let y = 12; // check: `y` is local not global!
|
||||||
|
// }
|
||||||
|
// print(y); // error, cannot find 'y'
|
||||||
|
|
||||||
// TODO: MORE Things that introduce an environment!
|
// TODO: MORE Things that introduce an environment!
|
||||||
_ => parent,
|
_ => parent,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue