mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8185257: Nashorn AST is missing nodes when a for-loop contains a VariableDeclarationList
Var declaration in for loop removed from block scope in es6 mode Reviewed-by: hannesw, sundar
This commit is contained in:
parent
551d0689ed
commit
2dc0eaaa4b
4 changed files with 96 additions and 1 deletions
|
@ -2053,10 +2053,18 @@ public class Parser extends AbstractParser implements Loggable {
|
|||
if (outer != null) {
|
||||
restoreBlock(outer);
|
||||
if (body != null) {
|
||||
List<Statement> statements = new ArrayList<>();
|
||||
for (final Statement var : outer.getStatements()) {
|
||||
if(var instanceof VarNode && !((VarNode)var).isBlockScoped()) {
|
||||
appendStatement(var);
|
||||
}else {
|
||||
statements.add(var);
|
||||
}
|
||||
}
|
||||
appendStatement(new BlockStatement(forLine, new Block(
|
||||
outer.getToken(),
|
||||
body.getFinish(),
|
||||
outer.getStatements())));
|
||||
statements)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue