[Webkit-unassigned] [Bug 150893] [ES6] Arrow function syntax. Using 'super' in arrow function that declared out of the class should lead to Syntax error

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Feb 7 12:41:39 PST 2016


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

--- Comment #10 from GSkachkov <gskachkov at gmail.com> ---
Comment on attachment 270654
  --> https://bugs.webkit.org/attachment.cgi?id=270654
Patch

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

>> Source/JavaScriptCore/ChangeLog:20
>> +        Invoking super()/super in two or more evals will be part of the issue https://bugs.webkit.org/show_bug.cgi?id=153864
> 
> what kind of error should this be if it's not a SyntaxError?

I've made small change in this sentence in the last patch.  
It should be SyntaxError, but my patch only partly resolve this issue. I had to fix case with 'eval("super")' because some of the  arrow function tests invoke eval('super'). During the  additional testing I found out that my current patch does not cover case when we call eval('eval('super()')'), but I decided that it should not be part of this patch and created the issue

>> Source/JavaScriptCore/bytecode/EvalCodeCache.h:70
>> +                        : derivedContextType;
> 
> style: make this one line or add "{}" to the else statement.

Done

>> Source/JavaScriptCore/bytecode/ExecutableInfo.h:67
>> +    DerivedContextType wrappedCodeBlocContextType() const { return static_cast<DerivedContextType>(m_wrappedCodeBlocContextType); }
> 
> typo:
> wrappedCodeBlocContextType => wrappedCodeBlockContextType

Done

>> Source/JavaScriptCore/parser/Parser.cpp:2070
>> +    if (!m_lexer->isReparsingFunction()) {
> 
> Is this needed or just an optimization?

I added comment in the last patch, I hope that now it is more clear:
    // It unncecessary to check of using super during reparsing one more time. Also it can lead to syntax error
    // in case of arrow function becuase during reparsing we don't know that parse arrow function
    // inside of the constructor or method

>> Source/JavaScriptCore/parser/Parser.h:881
>> +    // Find the closest not 'arrow function' function scope.
> 
> comment not needed.

Removed

>> Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js:-131
>> -     }
> 
> you could keep this if you turned this into an "return eval(blah)"

I've moved this test case to the LayoutTests/js/script-tests/arrowfunction-syntax-errors.js where I'm trying  to collect all case that are related to the syntax errors. 
See last case in 66 line in this file.

-- 
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/20160207/7700041d/attachment-0001.html>


More information about the webkit-unassigned mailing list