Ignore:
Timestamp:
Apr 15, 2017, 3:44:02 PM (8 years ago)
Author:
[email protected]
Message:

test262: test262/test/language/global-code/new.target-arrow.js
https://bugs.webkit.org/show_bug.cgi?id=170872

Patch by Joseph Pecoraro <Joseph Pecoraro> 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/ParserModes.h

    r208052 r215395  
    174174}
    175175
    176 
    177176ALWAYS_INLINE bool isModuleParseMode(SourceParseMode parseMode)
    178177{
     
    180179        SourceParseMode::ModuleAnalyzeMode,
    181180        SourceParseMode::ModuleEvaluateMode).contains(parseMode);
    182 } 
     181}
    183182
    184183ALWAYS_INLINE bool isProgramParseMode(SourceParseMode parseMode)
    185184{
    186185    return SourceParseModeSet(SourceParseMode::ProgramMode).contains(parseMode);
    187 }
     186}
     187
     188ALWAYS_INLINE bool isProgramOrModuleParseMode(SourceParseMode parseMode)
     189{
     190    return SourceParseModeSet(
     191        SourceParseMode::ProgramMode,
     192        SourceParseMode::ModuleAnalyzeMode,
     193        SourceParseMode::ModuleEvaluateMode).contains(parseMode);
     194}
    188195
    189196ALWAYS_INLINE ConstructAbility constructAbilityForParseMode(SourceParseMode parseMode)
Note: See TracChangeset for help on using the changeset viewer.