<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:sbarati&#64;apple.com" title="Saam Barati &lt;sbarati&#64;apple.com&gt;"> <span class="fn">Saam Barati</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function should support the destructuring parameters."
   href="https://bugs.webkit.org/show_bug.cgi?id=146934">bug 146934</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 #268861 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function should support the destructuring parameters."
   href="https://bugs.webkit.org/show_bug.cgi?id=146934#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [ES6] Arrow function syntax. Arrow function should support the destructuring parameters."
   href="https://bugs.webkit.org/show_bug.cgi?id=146934">bug 146934</a>
              from <span class="vcard"><a class="email" href="mailto:sbarati&#64;apple.com" title="Saam Barati &lt;sbarati&#64;apple.com&gt;"> <span class="fn">Saam Barati</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=268861&amp;action=diff" name="attach_268861" title="Patch">attachment 268861</a> <a href="attachment.cgi?id=268861&amp;action=edit" title="Patch">[details]</a></span>
Patch

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

this seems like the right approach, just a few comments to clean up the code.

<span class="quote">&gt; Source/JavaScriptCore/parser/Parser.h:1047
&gt; +    ALWAYS_INLINE bool isArrowFunctionNoOrOneParamter()
&gt;      {
&gt;          bool isArrowFunction = false;
&gt;          
&gt; -        if (match(EOFTOK))
&gt; +        if (match(EOFTOK) || (!match(IDENT) &amp;&amp; !match(OPENPAREN)))
&gt;              return isArrowFunction;
&gt;          
&gt;          SavePoint saveArrowFunctionPoint = createSavePoint();
&gt; +        if (match(IDENT))
&gt; +            isArrowFunction = consume(IDENT) &amp;&amp; match(ARROWFUNCTION);
&gt; +        else if (consume(OPENPAREN) &amp;&amp; consume(CLOSEPAREN))
&gt; +            isArrowFunction = match(ARROWFUNCTION);
&gt;          
&gt; -        if (consume(OPENPAREN)) {
&gt; -            bool isArrowFunctionParamters = true;
&gt; +        restoreSavePoint(saveArrowFunctionPoint);
&gt; +        
&gt; +        return isArrowFunction;
&gt; +    }</span >

This function has some redundancy with the below function, lets just combine
the necessary bits into the below function.

<span class="quote">&gt; Source/JavaScriptCore/parser/Parser.h:1049
&gt; +    template &lt;class TreeBuilder&gt; bool isArrowFunctionParamters(TreeBuilder&amp; context)</span >

We don't need to templatize this once we move it to SyntaxChecker (see below).
Also, this function has been misspelled, lets fix the spelling in this patch:
&quot;isArrowFunctionParamters&quot; =&gt; &quot;isArrowFunctionParameters&quot;

<span class="quote">&gt; Source/JavaScriptCore/parser/Parser.h:1057
&gt; +        if (isArrowFunctionNoOrOneParamter())
&gt; +            isArrowFunction = true;</span >

Instead of calling the above function, you
can just check:
```
if (match(IDENT)) {
   save point create;
   next();
   check if arrow function
   save point restore;
} else if ....
```

<span class="quote">&gt; Source/JavaScriptCore/parser/Parser.h:1066
&gt; +            unsigned parametersCount = 1;</span >

start this at zero.
Even though we ignore this number, it should start at zero.

<span class="quote">&gt; Source/JavaScriptCore/parser/Parser.h:1067
&gt; +            isArrowFunction = parseFormalParameters(context, context.createFormalParameterList(), parametersCount) &amp;&amp; consume(CLOSEPAREN) &amp;&amp; match(ARROWFUNCTION);</span >

Instead of passing in &quot;context&quot; here, we should create a SyntaxChecker and pass that in.
That way we're not actually allocating AST nodes that we throw away.

<span class="quote">&gt; LayoutTests/js/script-tests/arrowfunction-syntax.js:79
&gt;  </span >

add a test or a few tests for rest parameters:
```
(...rest) =&gt; rest;
```
etc.</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>