Fix function name inference corruption for async functions

The code which pushes and pops to the function name inference stack
generally checks if the stack is active with the IsOpen method. One
piece of code pertaining to async functions was missing that check.
This patch adds it.

BUG=chromium:658267
R=gsathya,caitp

Review-Url: https://codereview.chromium.org/2514893002
Cr-Commit-Position: refs/heads/master@{#41120}
This commit is contained in:
littledan 2016-11-18 10:31:28 -08:00 committed by Commit bot
parent 54e4b1fb5e
commit 06f8e87726
2 changed files with 10 additions and 3 deletions

View File

@ -45,9 +45,11 @@ void FuncNameInferrer::PushVariableName(const AstRawString* name) {
}
void FuncNameInferrer::RemoveAsyncKeywordFromEnd() {
DCHECK(names_stack_.length() > 0);
DCHECK(names_stack_.last().name->IsOneByteEqualTo("async"));
names_stack_.RemoveLast();
if (IsOpen()) {
DCHECK(names_stack_.length() > 0);
DCHECK(names_stack_.last().name->IsOneByteEqualTo("async"));
names_stack_.RemoveLast();
}
}
const AstString* FuncNameInferrer::MakeNameFromStack() {

View File

@ -0,0 +1,5 @@
// Copyright 2016 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.
assertThrows("class D extends async() =>", SyntaxError);