<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function"
   href="https://bugs.webkit.org/show_bug.cgi?id=144955#c12">Comment # 12</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function"
   href="https://bugs.webkit.org/show_bug.cgi?id=144955">bug 144955</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=253195&amp;action=diff" name="attach_253195" title="Patch">attachment 253195</a> <a href="attachment.cgi?id=253195&amp;action=edit" title="Patch">[details]</a></span>
Patch

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

<span class="quote">&gt;&gt;&gt; Source/JavaScriptCore/parser/ASTBuilder.h:372
&gt;&gt;&gt; +        : m_sourceCode-&gt;subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn);
&gt;&gt; 
&gt;&gt; Wrong indentation. ? and : should be exactly 4 spaces to the right from the beginning of &quot;SourceCode source&quot;.
&gt; 
&gt; I believe this is for the controlFlowProfiler</span >

Fixed. Please check if correct.

<span class="quote">&gt;&gt; Source/JavaScriptCore/parser/ASTBuilder.h:375
&gt;&gt; +        info.body-&gt;setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
&gt; 
&gt; Ditto. Indent the second line by exactly 4 spaces further to the right (12 total spaces).</span >

Why do we need indent for 'info.body-&gt;setLoc()' statement?

<span class="quote">&gt;&gt; Source/JavaScriptCore/parser/Lexer.cpp:1824
&gt;&gt; +            ASSERT(tokenData-&gt;offset &gt;= tokenData-&gt;lineStartOffset);
&gt; 
&gt; I don't think we want to shift() and then set offset back manually like this.
&gt; We should use peek() instead.</span >

Done

<span class="quote">&gt;&gt; Source/JavaScriptCore/parser/Parser.cpp:605
&gt;&gt; +    setEndOfStatement();
&gt; 
&gt; Why do we need this?</span >

Ohh, it will be difficult to explain with my English, but I'll try. 
I need invoke this function to set correctly position inside of the lexer. It is added by me in Source/JavaScriptCore/parser/Lexer.cpp line 1723 and repeat the same statement as do for '}'  in lexer <a href="https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Lexer.cpp#L1990">https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Lexer.cpp#L1990</a>. 
It is necessary because incase of arrow function with expression (var f = x=&gt; x+1;) symbols ';', ']', '}', ')', and ',' has two meaning first it is end of statement and  second end of arrow function body. I haven't found way move this logic to lexer because only parser knowing context when it is only end of statement or end of arrow function body as well.

<span class="quote">&gt;&gt;&gt; Source/JavaScriptCore/parser/Parser.cpp:1203
&gt;&gt;&gt; +            context.setEndOffset(result, m_lastTokenEndPosition.offset);
&gt;&gt; 
&gt;&gt; What is this setEndOffset for?
&gt; 
&gt; Actually, this is wrong. How does this code not segfault?
&gt; setEndOffset is meant to be called with non-null AST nodes</span >

Hmm, I run this method to set correct ending of the block for arrow function with expression for instance var f = x =&gt; x + 10; 
Where ';' is used as end of the statement var f...; and end of arrow function x=&gt;x+10;
For the same purpose as in this method <a href="https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L1426">https://github.com/WebKit/webkit/blob/master/Source/JavaScriptCore/parser/Parser.cpp#L1426</a>

<span class="quote">&gt;&gt; Source/JavaScriptCore/parser/Parser.cpp:2852
&gt;&gt; +    while (newCount--)
&gt; 
&gt; This should be tested.</span >

I've removed this code.</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>