02e4d21f4c
When eagerly parsing arrow functions, expressions in default parameter initializers are parsed in the enclosing scope, rather than in the function's scope (since that scope does not yet exist). This leads to VariableProxies being added to the wrong scope, and scope chains for FunctionLiterals being incorrect. This patch addresses these problems by adding a subclass of AstExpressionVisitor that moves VariableProxies to the proper scope and fixes up scope chains of FunctionLiterals. This is a revert of the revert https://crrev.com/e41614a058426fb6102e4ab2dd4f98997f00c0fc with a much-improved (though not yet perfect) Scope::ResetOuterScope method which properly fixes not only the outer_scope_ pointer but also fixes the inner_scope_ list in the relevant outer_scopes. More work likely still needs to be done to make this work completely, but it's very close to correct. BUG=v8:4395 LOG=y Review URL: https://codereview.chromium.org/1414283002 Cr-Commit-Position: refs/heads/master@{#31435}
23 lines
610 B
C++
23 lines
610 B
C++
// Copyright 2015 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.
|
|
|
|
#ifndef V8_PARAMETER_EXPRESSION_REWRITER_H_
|
|
#define V8_PARAMETER_EXPRESSION_REWRITER_H_
|
|
|
|
#include "src/ast.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
|
|
void RewriteParameterInitializerScope(uintptr_t stack_limit,
|
|
Expression* initializer, Scope* old_scope,
|
|
Scope* new_scope);
|
|
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_PARAMETER_EXPRESSION_REWRITER_H_
|