Expected Behavior
With the following code,
for (let a = 0; a < 10; a++) {
console.log(a);
let b = 10;
}
There are two different scopes. ForStatement.body (i.e. BlockStatement) can access variable a and variable b. However, ForStatement.test and ForStatement.update (i.e. BinaryExpression and UpdateExpression) can only access variable a.
Actual Behavior
attachScopes only attaches scope object to BlockStatement
Additional Information