<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:gskachkov&#64;gmail.com" title="GSkachkov &lt;gskachkov&#64;gmail.com&gt;"> <span class="fn">GSkachkov</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;super&quot; property"
   href="https://bugs.webkit.org/show_bug.cgi?id=149615">bug 149615</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #267799 is obsolete</td>
           <td>1
           </td>
           <td>
               &nbsp;
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;super&quot; property"
   href="https://bugs.webkit.org/show_bug.cgi?id=149615#c15">Comment # 15</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;super&quot; property"
   href="https://bugs.webkit.org/show_bug.cgi?id=149615">bug 149615</a>
              from <span class="vcard"><a class="email" href="mailto:gskachkov&#64;gmail.com" title="GSkachkov &lt;gskachkov&#64;gmail.com&gt;"> <span class="fn">GSkachkov</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=267799&amp;action=diff" name="attach_267799" title="Patch">attachment 267799</a> <a href="attachment.cgi?id=267799&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=267799&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=267799&amp;action=review</a>

<span class="quote">&gt;&gt; Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp:69
&gt;&gt; +    // this executable is part of the class
&gt; 
&gt; comment isn't needed</span >

Removed

<span class="quote">&gt;&gt; Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:575
&gt;&gt; +    if (SourceParseMode::ArrowFunctionMode == parseMode &amp;&amp; (functionNode-&gt;usesThis() || isDerivedClassContext() || isDerivedConstructorContext()))
&gt; 
&gt; Why are these new conditions needed?
&gt; Why do we need to load this if we're &quot;SourceParseMode::ArrowFunctionMode == parseMode &amp;&amp; (isDerivedClassContext() || isDerivedConstructorContext())&quot;?</span >

Without this condition following code will raise ReferenceError 'this' is undefined so to fix this error I've added this condition.

var A = class A {
    constructor() {
        this.value = 'testValue';
    }
    getValue () {
        return this.value;
    }

};

var B = class B extends A {
    getParentValue() {
        var arrow  = () =&gt; super.getValue();
        return arrow();
    }
};

var b = new B();
b. getParentValue()

<span class="quote">&gt;&gt; Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4050
&gt;&gt; +    if ((isConstructor() &amp;&amp; constructorKind() == ConstructorKind::Derived) || (m_codeBlock-&gt;isClassContext())) {
&gt; 
&gt; style: the parens around &quot;m_codeBlock-&gt;isClassContext()&quot; aren't needed.</span >

Done

<span class="quote">&gt;&gt; Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:813
&gt;&gt; +                }
&gt; 
&gt; Nit: I think this whole section of code would be easier to read like this:
&gt; ```
&gt; if (constructorKind() == ConstructorKind::Derived || isDerivedConstructorContext())
&gt;     newDerivedContextType = DerivedContextType::DerivedConstructorContext;
&gt; else if (m_codeBlock-&gt;isClassContext() || (m_codeBlock-&gt;isArrowFunction() &amp;&amp; m_derivedContextType == DerivedContextType::DerivedMethodContext))
&gt;     newDerivedContextType =  DerivedContextType::DerivedMethodContext
&gt; ```
&gt; 
&gt; Also, why do we need to check &quot;m_codeBlock-&gt;isArrowFunction()&quot; when checking &quot;m_derivedContextType == DerivedContextType::DerivedMethodContext&quot;?
&gt; When would we have &quot;!m_codeBlock-&gt;isArrowFunction() &amp;&amp; m_derivedContextType == DerivedContextType::DerivedMethodContext&quot;?</span >

Ohh, I see. We don't need to check m_codeBlock-&gt;isArrowFunction() because it already true because of this condition metadata-&gt;parseMode() == SourceParseMode::ArrowFunctionMode.

<span class="quote">&gt;&gt; Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:182
&gt;&gt; +        RegisterID* scope = generator.emitLoadDerivedConstructorFromArrowFunctionLexicalEnvironment();    
&gt; 
&gt; This isn't a JSScope. Maybe a better variable name is &quot;derivedConstructor&quot; or something similar.</span >

Renamed

<span class="quote">&gt;&gt; Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp:195
&gt;&gt; +    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()-&gt;derivedContextType(), codeBlock.unlinkedCodeBlock()-&gt;isArrowFunction(), &amp;variablesUnderTDZ);
&gt; 
&gt; have you tried this out inside the inspector to make sure it works?
&gt; I.e, pausing inside an arrow function and typing in &quot;super&quot; into the console?</span >

Good question. I vent done this. I've checked and it does not work. When I typing 'super' into console it raise exception 'SyntaxError: super is only valid inside functions.' The same behavior inside of the method of class and inside of the arrow function in class method. Looks like bug in class implementation.

<span class="quote">&gt;&gt; Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js:160
&gt;&gt; +      erorr = true;
&gt; 
&gt; typo: &quot;erorr&quot; =&gt; &quot;error&quot;</span >

Fixed

<span class="quote">&gt;&gt; LayoutTests/js/script-tests/arrowfunction-superproperty.js:78
&gt;&gt; +// FIXME: Problem with access to the super before super in constructor
&gt; 
&gt; nit: &quot;super before super&quot; =&gt; &quot;super before super()&quot;</span >

Done</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>