Commit 8e32805f authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[parsing] Make FuncNameInferrer handle `extends` clauses properly

Bug: v8:7069
Change-Id: I878ea42207013a76de859c96f3cb5e2d93aa7927
Reviewed-on: https://chromium-review.googlesource.com/803908Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran (ooo until 12/12) <gsathya@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50008}
parent 298f0cd4
......@@ -4470,6 +4470,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
scope()->set_start_position(scanner()->location().end_pos);
if (Check(Token::EXTENDS)) {
FuncNameInferrer::State fni_state(fni_);
ExpressionClassifier extends_classifier(this);
class_info.extends = ParseLeftHandSideExpression(CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK);
......
......@@ -555,3 +555,19 @@ TEST(ReturnAnonymousFunction) {
script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked();
CheckFunctionName(script, "return 2012", "");
}
TEST(IgnoreExtendsClause) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"(function() {\n"
" var foo = {};\n"
" foo.C = class {}\n"
" class D extends foo.C {}\n"
" foo.bar = function() { return 1; };\n"
"})()");
script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked();
CheckFunctionName(script, "return 1", "foo.bar");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment