[parsing] Fix rest parameter handling in preparser.

Since preparser creates different scopes than the parser, the invariant "at most one rest parameter" doesn't hold when the rest param is a destructuring param.

No new tests added; the problem is visible w/ existing tests with FLAG_lazy_inner_functions on.

R=​vogelheim@chromium.org
BUG=chromium:690919

Change-Id: I525b8dfee92acd0733702c5a940a1a83a94712df
Reviewed-on: https://chromium-review.googlesource.com/440925
Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43117}
This commit is contained in:
Marja Hölttä 2017-02-10 17:08:28 +01:00 committed by Commit Bot
parent 53c11006e5
commit ded4cae2c2

View File

@ -974,7 +974,7 @@ Variable* DeclarationScope::DeclareParameterName(
AstValueFactory* ast_value_factory) {
DCHECK(!already_resolved_);
DCHECK(is_function_scope() || is_module_scope());
DCHECK(!has_rest_);
DCHECK(!has_rest_ || is_rest);
DCHECK(is_being_lazily_parsed_);
has_rest_ = is_rest;
if (name == ast_value_factory->arguments_string()) {