| Index: src/scopes.cc
|
| diff --git a/src/scopes.cc b/src/scopes.cc
|
| index 93268ad31905015d78f014430124f70e6e7d1807..f4cf85144a4df19d6142fbccdd0637dbd2cca699 100644
|
| --- a/src/scopes.cc
|
| +++ b/src/scopes.cc
|
| @@ -136,11 +136,21 @@ Scope::Scope(Zone* zone, Scope* inner_scope,
|
| }
|
|
|
|
|
| +void Scope::SetParameterExpressionsScopeFor(Scope* function_scope) {
|
| + DCHECK(function_scope->outer_scope() == outer_scope());
|
| + DCHECK(function_scope->is_function_scope());
|
| + DCHECK_NULL(parameter_scope_);
|
| + SetScopeName(ast_value_factory_->GetOneByteString("parameter expressions"));
|
| + parameter_scope_ = function_scope;
|
| +}
|
| +
|
| +
|
| void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
|
| Handle<ScopeInfo> scope_info,
|
| FunctionKind function_kind) {
|
| outer_scope_ = outer_scope;
|
| scope_type_ = scope_type;
|
| + parameter_scope_ = nullptr;
|
| function_kind_ = function_kind;
|
| block_scope_is_class_scope_ = false;
|
| scope_name_ = ast_value_factory_->empty_string();
|
| @@ -377,6 +387,13 @@ Scope* Scope::FinalizeBlockScope() {
|
|
|
|
|
| Variable* Scope::LookupLocal(const AstRawString* name) {
|
| + if (parameter_scope_) {
|
| + Variable* result = parameter_scope_->variables_.Lookup(name);
|
| + if (result != nullptr && parameter_scope_->params_.Contains(result)) {
|
| + return result;
|
| + }
|
| + }
|
| +
|
| Variable* result = variables_.Lookup(name);
|
| if (result != NULL || scope_info_.is_null()) {
|
| return result;
|
| @@ -452,12 +469,13 @@ Variable* Scope::Lookup(const AstRawString* name) {
|
|
|
|
|
| Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode,
|
| - bool is_rest) {
|
| + ParameterKind kind) {
|
| DCHECK(!already_resolved());
|
| DCHECK(is_function_scope());
|
| Variable* var = variables_.Declare(this, name, mode, Variable::NORMAL,
|
| kCreatedInitialized);
|
| - if (is_rest) {
|
| + var->set_parameter_kind(kind);
|
| + if (kind == RestParameter) {
|
| DCHECK_NULL(rest_parameter_);
|
| rest_parameter_ = var;
|
| rest_index_ = num_parameters();
|
|
|