<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206647] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206647">206647</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-09-30 11:44:16 -0700 (Fri, 30 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Arrow functions should not allow duplicate parameter names
https://bugs.webkit.org/show_bug.cgi?id=162741

Reviewed by Filip Pizlo.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

This patch makes parsing arrow function parameters throw
a syntax error when there are duplicate parameter names.
It also starts to make some syntax errors for arrow functions
better, however, this is trickier than it seems since we need
to choose between two parsing productions when we decide to
throw a syntax error. I'm going to work on this problem
in another patch specifically devoted to making the error
messages better for parsing arrow functions:
https://bugs.webkit.org/show_bug.cgi?id=162794

* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::isArrowFunctionParameters):
(JSC::Parser&lt;LexerType&gt;::parseFormalParameters):
(JSC::Parser&lt;LexerType&gt;::parseFunctionParameters):
(JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
* parser/Parser.h:

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTeststest262yaml">trunk/JSTests/test262.yaml</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsparsersyntaxcheckexpectedtxt">trunk/LayoutTests/js/parser-syntax-check-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsparsersyntaxcheckjs">trunk/LayoutTests/js/script-tests/parser-syntax-check.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/JSTests/ChangeLog        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -1,5 +1,14 @@
</span><span class="cx"> 2016-09-30  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Arrow functions should not allow duplicate parameter names
+        https://bugs.webkit.org/show_bug.cgi?id=162741
+
+        Reviewed by Filip Pizlo.
+
+        * test262.yaml:
+
+2016-09-30  Saam Barati  &lt;sbarati@apple.com&gt;
+
</ins><span class="cx">         Make some microbenchmarks run for less time.
</span><span class="cx"> 
</span><span class="cx">         Rubber stamped by Filip Pizlo.
</span></span></pre></div>
<a id="trunkJSTeststest262yaml"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/test262.yaml (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/test262.yaml        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/JSTests/test262.yaml        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -54254,7 +54254,7 @@
</span><span class="cx"> - path: test262/test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-rest.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;SyntaxError&quot;, [&quot;../../../../../../harness/assert.js&quot;, &quot;../../../../../../harness/sta.js&quot;], [:strict]
</span><span class="cx"> - path: test262/test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js
</span><del>-  cmd: runTest262 :fail, &quot;SyntaxError&quot;, [&quot;../../../../../../harness/assert.js&quot;, &quot;../../../../../../harness/sta.js&quot;], []
</del><ins>+  cmd: runTest262 :normal, &quot;SyntaxError&quot;, [&quot;../../../../../../harness/assert.js&quot;, &quot;../../../../../../harness/sta.js&quot;], []
</ins><span class="cx"> - path: test262/test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;SyntaxError&quot;, [&quot;../../../../../../harness/assert.js&quot;, &quot;../../../../../../harness/sta.js&quot;], [:strict]
</span><span class="cx"> - path: test262/test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval.js
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/LayoutTests/ChangeLog        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-09-30  Saam Barati  &lt;sbarati@apple.com&gt;
+
+        Arrow functions should not allow duplicate parameter names
+        https://bugs.webkit.org/show_bug.cgi?id=162741
+
+        Reviewed by Filip Pizlo.
+
+        * js/parser-syntax-check-expected.txt:
+        * js/script-tests/parser-syntax-check.js:
+
</ins><span class="cx"> 2016-09-30  Megan Gardner  &lt;megan_gardner@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make it possible to test web-related user-interface features
</span></span></pre></div>
<a id="trunkLayoutTestsjsparsersyntaxcheckexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/parser-syntax-check-expected.txt (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/parser-syntax-check-expected.txt        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/LayoutTests/js/parser-syntax-check-expected.txt        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -1462,6 +1462,36 @@
</span><span class="cx"> PASS Valid:   &quot;function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () =&gt; super.foo) { super(); this._x_f = x; } x() { return this._x_f(); } } }&quot;
</span><span class="cx"> PASS Valid:   &quot;class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () =&gt; super()) { x(); } x() { return super.foo; } }&quot;
</span><span class="cx"> PASS Valid:   &quot;function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () =&gt; super()) { x(); } x() { return super.foo; } } }&quot;
</span><ins>+PASS Invalid: &quot;let x = (a,a)=&gt;a;&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;function f() { let x = (a,a)=&gt;a; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;let x = ([a],a)=&gt;a;&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ([a],a)=&gt;a; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = ([a, a])=&gt;a;&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ([a, a])=&gt;a; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = ({a, b:{a}})=&gt;a;&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ({a, b:{a}})=&gt;a; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = (a,a)=&gt;{ a };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;function f() { let x = (a,a)=&gt;{ a }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;let x = ([a],a)=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ([a],a)=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = ([a, a])=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ([a, a])=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = ([a, a])=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = ([a, a])=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = (a, ...a)=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '...'&quot;
+PASS Invalid: &quot;function f() { let x = (a, ...a)=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '...'&quot;
+PASS Invalid: &quot;let x = (b, c, b)=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'b' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;function f() { let x = (b, c, b)=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'b' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;let x = (a, b, c, d, {a})=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;function f() { let x = (a, b, c, d, {a})=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters.&quot;
+PASS Invalid: &quot;let x = (b = (a,a)=&gt;a, b)=&gt;{ };&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;function f() { let x = (b = (a,a)=&gt;a, b)=&gt;{ }; }&quot;. Produced the following syntax error: &quot;SyntaxError: Duplicate parameter 'a' not allowed in an arrow function.&quot;
+PASS Invalid: &quot;((a,a)=&gt;a);&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list.&quot;
+PASS Invalid: &quot;function f() { ((a,a)=&gt;a); }&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list.&quot;
+PASS Invalid: &quot;let x = (a)
+=&gt;a;&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '=&gt;'&quot;
+PASS Invalid: &quot;function f() { let x = (a)
+=&gt;a; }&quot;. Produced the following syntax error: &quot;SyntaxError: Unexpected token '=&gt;'&quot;
</ins><span class="cx"> Weird things that used to crash.
</span><span class="cx"> PASS Invalid: &quot;or ([[{break //(elseifo (a=0;a&lt;2;a++)n=
</span><span class="cx">         [[{aFYY sga=
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsparsersyntaxcheckjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/parser-syntax-check.js (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/parser-syntax-check.js        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/LayoutTests/js/script-tests/parser-syntax-check.js        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -843,6 +843,20 @@
</span><span class="cx"> valid(&quot;class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = (y = () =&gt; super.foo) =&gt; {return y()}) { return y(); } }&quot;);
</span><span class="cx"> valid(&quot;class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () =&gt; super.foo) { super(); this._x_f = x; } x() { return this._x_f(); } }&quot;);
</span><span class="cx"> valid(&quot;class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () =&gt; super()) { x(); } x() { return super.foo; } }&quot;);
</span><ins>+invalid(&quot;let x = (a,a)=&gt;a;&quot;);
+invalid(&quot;let x = ([a],a)=&gt;a;&quot;);
+invalid(&quot;let x = ([a, a])=&gt;a;&quot;);
+invalid(&quot;let x = ({a, b:{a}})=&gt;a;&quot;);
+invalid(&quot;let x = (a,a)=&gt;{ a };&quot;);
+invalid(&quot;let x = ([a],a)=&gt;{ };&quot;);
+invalid(&quot;let x = ([a, a])=&gt;{ };&quot;);
+invalid(&quot;let x = ([a, a])=&gt;{ };&quot;);
+invalid(&quot;let x = (a, ...a)=&gt;{ };&quot;);
+invalid(&quot;let x = (b, c, b)=&gt;{ };&quot;);
+invalid(&quot;let x = (a, b, c, d, {a})=&gt;{ };&quot;);
+invalid(&quot;let x = (b = (a,a)=&gt;a, b)=&gt;{ };&quot;);
+invalid(&quot;((a,a)=&gt;a);&quot;);
+invalid(&quot;let x = (a)\n=&gt;a;&quot;);
</ins><span class="cx"> 
</span><span class="cx"> debug(&quot;Weird things that used to crash.&quot;);
</span><span class="cx"> invalid(`or ([[{break //(elseifo (a=0;a&lt;2;a++)n=
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-09-30  Saam Barati  &lt;sbarati@apple.com&gt;
+
+        Arrow functions should not allow duplicate parameter names
+        https://bugs.webkit.org/show_bug.cgi?id=162741
+
+        Reviewed by Filip Pizlo.
+
+        This patch makes parsing arrow function parameters throw
+        a syntax error when there are duplicate parameter names.
+        It also starts to make some syntax errors for arrow functions
+        better, however, this is trickier than it seems since we need
+        to choose between two parsing productions when we decide to
+        throw a syntax error. I'm going to work on this problem
+        in another patch specifically devoted to making the error
+        messages better for parsing arrow functions:
+        https://bugs.webkit.org/show_bug.cgi?id=162794
+
+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::isArrowFunctionParameters):
+        (JSC::Parser&lt;LexerType&gt;::parseFormalParameters):
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionParameters):
+        (JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
+        * parser/Parser.h:
+
</ins><span class="cx"> 2016-09-30  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use topVMEntryFrame to determine whether to skip the re-throw of a simulated throw.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx">     logError(shouldPrintToken, __VA_ARGS__); \
</span><span class="cx"> } while (0)
</span><span class="cx"> 
</span><del>-#define propagateError() do { if (hasError()) return 0; } while (0)
</del><ins>+#define propagateError() do { if (UNLIKELY(hasError())) return 0; } while (0)
</ins><span class="cx"> #define internalFailWithMessage(shouldPrintToken, ...) do { updateErrorMessage(shouldPrintToken, __VA_ARGS__); return 0; } while (0)
</span><span class="cx"> #define handleErrorToken() do { if (m_token.m_type == EOFTOK || m_token.m_type &amp; ErrorTokenFlag) { failDueToUnexpectedToken(); } } while (0)
</span><span class="cx"> #define failWithMessage(...) do { { handleErrorToken(); updateErrorMessage(true, __VA_ARGS__); } return 0; } while (0)
</span><span class="lines">@@ -370,8 +370,9 @@
</span><span class="cx"> 
</span><span class="cx">             unsigned parametersCount = 0;
</span><span class="cx">             unsigned functionLength = 0;
</span><del>-            isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), parametersCount, functionLength) &amp;&amp; consume(CLOSEPAREN) &amp;&amp; match(ARROWFUNCTION);
-                
</del><ins>+            bool isArrowFunctionParameterList = true;
+            isArrowFunction = parseFormalParameters(syntaxChecker, syntaxChecker.createFormalParameterList(), isArrowFunctionParameterList, parametersCount, functionLength) &amp;&amp; consume(CLOSEPAREN) &amp;&amp; match(ARROWFUNCTION);
+            propagateError();
</ins><span class="cx">             popScope(fakeScope, syntaxChecker.NeedsFreeVariableInfo);
</span><span class="cx">         }
</span><span class="cx">         restoreSavePoint(saveArrowFunctionPoint);
</span><span class="lines">@@ -1838,7 +1839,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;typename LexerType&gt;
</span><del>-template &lt;class TreeBuilder&gt; bool Parser&lt;LexerType&gt;::parseFormalParameters(TreeBuilder&amp; context, TreeFormalParameterList list, unsigned&amp; parameterCount, unsigned&amp; functionLength)
</del><ins>+template &lt;class TreeBuilder&gt; bool Parser&lt;LexerType&gt;::parseFormalParameters(TreeBuilder&amp; context, TreeFormalParameterList list, bool isArrowFunction, unsigned&amp; parameterCount, unsigned&amp; functionLength)
</ins><span class="cx"> {
</span><span class="cx"> #define failIfDuplicateIfViolation() \
</span><span class="cx">     if (duplicateParameter) {\
</span><span class="lines">@@ -1845,6 +1846,7 @@
</span><span class="cx">         semanticFailIfTrue(hasDefaultParameterValues, &quot;Duplicate parameter '&quot;, duplicateParameter-&gt;impl(), &quot;' not allowed in function with default parameter values&quot;);\
</span><span class="cx">         semanticFailIfTrue(hasDestructuringPattern, &quot;Duplicate parameter '&quot;, duplicateParameter-&gt;impl(), &quot;' not allowed in function with destructuring parameters&quot;);\
</span><span class="cx">         semanticFailIfTrue(isRestParameter, &quot;Duplicate parameter '&quot;, duplicateParameter-&gt;impl(), &quot;' not allowed in function with a rest parameter&quot;);\
</span><ins>+        semanticFailIfTrue(isArrowFunction, &quot;Duplicate parameter '&quot;, duplicateParameter-&gt;impl(), &quot;' not allowed in an arrow function&quot;);\
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool hasDefaultParameterValues = false;
</span><span class="lines">@@ -1966,8 +1968,10 @@
</span><span class="cx">                 if (match(CLOSEPAREN)) {
</span><span class="cx">                     functionInfo.parameterCount = 0;
</span><span class="cx">                     functionInfo.functionLength = 0;
</span><del>-                } else
-                    failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount, functionInfo.functionLength), &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
</del><ins>+                } else {
+                    bool isArrowFunction = true;
+                    failIfFalse(parseFormalParameters(context, parameterList, isArrowFunction, functionInfo.parameterCount, functionInfo.functionLength), &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
+                }
</ins><span class="cx">                 
</span><span class="cx">                 consumeOrFail(CLOSEPAREN, &quot;Expected a ')' or a ',' after a parameter declaration&quot;);
</span><span class="cx">             } else {
</span><span class="lines">@@ -2012,8 +2016,10 @@
</span><span class="cx">         if (match(CLOSEPAREN)) {
</span><span class="cx">             functionInfo.parameterCount = 0;
</span><span class="cx">             functionInfo.functionLength = 0;
</span><del>-        } else
-            failIfFalse(parseFormalParameters(context, parameterList, functionInfo.parameterCount, functionInfo.functionLength), &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
</del><ins>+        } else {
+            bool isArrowFunction = false;
+            failIfFalse(parseFormalParameters(context, parameterList, isArrowFunction, functionInfo.parameterCount, functionInfo.functionLength), &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
+        }
</ins><span class="cx">         consumeOrFail(CLOSEPAREN, &quot;Expected a ')' or a ',' after a parameter declaration&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3410,6 +3416,8 @@
</span><span class="cx">                     currentScope()-&gt;revertToPreviousUsedVariables(usedVariablesSize);
</span><span class="cx">                 return parseArrowFunctionExpression(context, isAsyncArrow);
</span><span class="cx">             }
</span><ins>+            if (isArrowFunctionToken)
+                propagateError();
</ins><span class="cx">             restoreSavePointWithError(errorRestorationSavePoint);
</span><span class="cx">             if (isArrowFunctionToken)
</span><span class="cx">                 failDueToUnexpectedToken();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (206646 => 206647)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-09-30 18:39:59 UTC (rev 206646)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-09-30 18:44:16 UTC (rev 206647)
</span><span class="lines">@@ -1490,7 +1490,7 @@
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeExpression parsePropertyMethod(TreeBuilder&amp; context, const Identifier* methodName, bool isGenerator, bool isAsyncMethod);
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeProperty parseGetterSetter(TreeBuilder&amp;, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty);
</span><span class="cx">     template &lt;class TreeBuilder&gt; ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&amp;, SyntaxChecker&amp;, const JSTokenLocation&amp;, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, unsigned, SourceParseMode);
</span><del>-    template &lt;class TreeBuilder&gt; ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&amp;, TreeFormalParameterList, unsigned&amp;, unsigned&amp;);
</del><ins>+    template &lt;class TreeBuilder&gt; ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&amp;, TreeFormalParameterList, bool isArrowFunction, unsigned&amp;, unsigned&amp;);
</ins><span class="cx">     enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeExpression parseVariableDeclarationList(TreeBuilder&amp;, int&amp; declarations, TreeDestructuringPattern&amp; lastPattern, TreeExpression&amp; lastInitializer, JSTextPosition&amp; identStart, JSTextPosition&amp; initStart, JSTextPosition&amp; initEnd, VarDeclarationListContext, DeclarationType, ExportType, bool&amp; forLoopConstDoesNotHaveInitializer);
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeSourceElements parseArrowFunctionSingleExpressionBodySourceElements(TreeBuilder&amp;);
</span></span></pre>
</div>
</div>

</body>
</html>