test262: test262/test/language/global-code/new.target-arrow.js
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Apr 2017 22:44:02 +0000 (22:44 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Apr 2017 22:44:02 +0000 (22:44 +0000)
commit935b42175c602f905af9a562f3211ba8a2cba4cd
treeee7f4ff50aa1f1c1f73a42c13834e074664dc51e
parent079acbb35c890f3d5987aa5318109e14d1d796ef
test262: test262/test/language/global-code/new.target-arrow.js
https://bugs.webkit.org/show_bug.cgi?id=170872

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-04-15
Reviewed by Saam Barati.

JSTests:

* stress/async-arrow-functions-lexical-new.target-binding.js:
(shouldThrowAsync): Deleted.
(shouldThrowAsync.async): Deleted.
This code should have thrown a SyntaxError. Instead it was throwing
a ReferenceError for the internal @newTargetLocal variable.

* stress/new-target-syntax-errors.js:
Cover the arrow function in global code cases.

* ChakraCore.yaml:
* ChakraCore/test/es6/globalLambdaNewTargetSyntaxError.baseline-jsc:
We now pass with an expected SyntaxError. Our error message is different.

* test262.yaml:

Source/JavaScriptCore:

* parser/Parser.cpp:
(JSC::Parser<LexerType>::Parser):
Mark the global code scope.

(JSC::Parser<LexerType>::parseMemberExpression):
If new.target is detected in an arrow function defined in global scope
throw a SyntaxError.

* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setIsGlobalCodeScope):
(JSC::Scope::isGlobalCodeScope):
Marker for a global code scope.

* parser/ParserModes.h:
(JSC::isModuleParseMode):
(JSC::isProgramParseMode):
(JSC::isProgramOrModuleParseMode):
Helper for detecting global code based on parse mode.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChakraCore.yaml
JSTests/ChakraCore/test/es6/globalLambdaNewTargetSyntaxError.baseline-jsc
JSTests/ChangeLog
JSTests/stress/async-arrow-functions-lexical-new.target-binding.js
JSTests/stress/new-target-syntax-errors.js
JSTests/test262.yaml
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/parser/ParserModes.h