HaxeFoundation / HaxeFoundation/hscript

Variable scope issue

Open
#91 0 comments 1 reaction 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.