chakra-core / chakra-core/ChakraCore

Hoisting a var declaration past a lexical declaration of the same name should be a SyntaxError

Open
#357 4 comments 0 reactions 0 assignees View on GitHub
Bug help wanted Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Second bullet point of [block static semantics](https://tc39.github.io/ecma262/#sec-block-static-semantics-early-errors) and similarly for function body static semantics.

E.g.

``` javascript
let x;
{
var x; // error (already works)
let y;
var y; // should be an error (doesn't work)
{
var y; // should also be an error (doesn't work)
}
}
```

This applies for var declarations hoisting past all lexical declarations, i.e. `let`, `const`, `class`, `function` (and generators and async functions).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.