[Webkit-unassigned] [Bug 153864] Invoking super()/super inside of the eval should not lead to SyntaxError

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 7 19:04:13 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=153864

--- Comment #3 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 273142
  --> https://bugs.webkit.org/attachment.cgi?id=273142
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=273142&action=review

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:307
> +            return !(m_codeBlock->isArrowFunction() || m_codeType == EvalCode) || m_isNewTargetLoadedInArrowFunction
>                  ? m_newTargetRegister : emitLoadNewTargetFromArrowFunctionLexicalEnvironment();

This function is getting hard to read. I vote for an if statement here.
Also, I found a bug in the logic of caching here:
https://bugs.webkit.org/show_bug.cgi?id=155153

> Source/JavaScriptCore/parser/Parser.cpp:2068
> +            ConstructorKind functionConstructorKind = functionBodyType == StandardFunctionBodyBlock && !m_isEvalContext

Don't we already know if we're parsing an eval?
Why do we need m_isEvalContext?
Maybe I'm mistaken.

> Source/JavaScriptCore/parser/Parser.cpp:3820
> +        semanticFailIfFalse(currentScope()->isFunction() || (m_isEvalContext && closestParentOrdinaryFunctionNonLexicalScope()->expectedSuperBinding() == SuperBinding::Needed), "super is only valid inside functions");

This error message should be updated.

> Source/JavaScriptCore/runtime/CodeCache.cpp:104
> +    bool isEvalConext = true;

This is definitely not true. This should probably be a parameter to this function.

> Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js:232
> +class K extends A {

let's have some eval tests inside a constructor.
tests for TDZ, etc.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160308/57d48da3/attachment.html>


More information about the webkit-unassigned mailing list