[ast] AstTraversalVisitor should visit the Declarations of Block scopes
R=marja@chromium.org Bug: v8:6509 Change-Id: If8be12e2ce6c00de0bdee38ab721ef5b7b47efe5 Reviewed-on: https://chromium-review.googlesource.com/556239 Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#46331}
This commit is contained in:
parent
8516076a6c
commit
4c79544cca
@ -136,6 +136,9 @@ void AstTraversalVisitor<Subclass>::VisitFunctionDeclaration(
|
||||
template <class Subclass>
|
||||
void AstTraversalVisitor<Subclass>::VisitBlock(Block* stmt) {
|
||||
PROCESS_NODE(stmt);
|
||||
if (stmt->scope() != nullptr) {
|
||||
RECURSE_EXPRESSION(VisitDeclarations(stmt->scope()->declarations()));
|
||||
}
|
||||
RECURSE(VisitStatements(stmt->statements()));
|
||||
}
|
||||
|
||||
|
24
test/mjsunit/regress/regress-6509.js
Normal file
24
test/mjsunit/regress/regress-6509.js
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
(function testSloppy() {
|
||||
var arrow = (sth = (function f() {
|
||||
{
|
||||
function f2() { }
|
||||
}
|
||||
})()) => 0;
|
||||
|
||||
assertEquals(0, arrow());
|
||||
})();
|
||||
|
||||
(function testStrict() {
|
||||
"use strict";
|
||||
var arrow = (sth = (function f() {
|
||||
{
|
||||
function f2() { }
|
||||
}
|
||||
})()) => 0;
|
||||
|
||||
assertEquals(0, arrow());
|
||||
})();
|
Loading…
Reference in New Issue
Block a user