Ignore:
Timestamp:
Mar 17, 2016, 2:46:07 AM (9 years ago)
Author:
[email protected]
Message:

Invoking super()/super inside of the eval should not lead to SyntaxError
https://bugs.webkit.org/show_bug.cgi?id=153864

Reviewed by Saam Barati.

Source/JavaScriptCore:

Added support of the invoking super/super() inside of the eval within class.
Also support cases when eval is invoked in constructor, class method directly
or via arrow function. Access to the new.target in eval is not part of this patch
and will be implemented in https://bugs.webkit.org/show_bug.cgi?id=155545

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitLoadArrowFunctionLexicalEnvironment):
(JSC::BytecodeGenerator::isThisUsedInInnerArrowFunction):
(JSC::BytecodeGenerator::isNewTargetUsedInInnerArrowFunction):
(JSC::BytecodeGenerator::isSuperUsedInInnerArrowFunction):
(JSC::BytecodeGenerator::isSuperCallUsedInInnerArrowFunction):
(JSC::BytecodeGenerator::emitPutThisToArrowFunctionContextScope):

  • interpreter/Interpreter.cpp:

(JSC::eval):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::Parser):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseMemberExpression):

  • parser/Parser.h:

(JSC::Scope::Scope):
(JSC::Scope::isEvalContext):
(JSC::Scope::setIsEvalContext):
(JSC::parse):

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getGlobalCodeBlock):

  • tests/stress/arrowfunction-lexical-bind-supercall-4.js:
  • tests/stress/arrowfunction-lexical-bind-superproperty.js:
  • tests/stress/class-syntax-super-in-eval.js: Added.
  • tests/stress/generator-with-super.js:

LayoutTests:

  • js/class-syntax-super-expected.txt:
  • js/script-tests/class-syntax-super.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CodeCache.cpp

    r197308 r198324  
    101101        return unlinkedCodeBlock;
    102102    }
    103 
    104103    typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
     104    DerivedContextType derivedContextType = executable->derivedContextType();
    105105    std::unique_ptr<RootNode> rootNode = parse<RootNode>(
    106         &vm, source, Identifier(), builtinMode, strictMode,
    107         CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, thisTDZMode);
     106        &vm, source, Identifier(), builtinMode, strictMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, thisTDZMode, derivedContextType);
    108107    if (!rootNode)
    109108        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.