HaxeFoundation / HaxeFoundation/hscript
Variable scope issue
Open
- Dominant language
- Haxe
- Stars
- 309
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Description
When using `if` without brackets, the scope stays the same and variables can be shadowed:
```haxe
var expr = '
var a = "test";
if (true) var a = 42;
return a;
';
var parser = new hscript.Parser();
var ast = parser.parseString(expr);
var interp = new hscript.Interp();
trace(interp.execute(ast)); // 42
```
Works as expected when using brackets.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.