<!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>[185989] 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/185989">185989</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-25 23:49:20 -0700 (Thu, 25 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/JavaScriptCore:
 [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function.
 https://bugs.webkit.org/show_bug.cgi?id=144955

 Reviewed by Yusuke Suzuki.

 Added support of ES6 arrow function. Changes were made according to following spec http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax. Patch does not include any arrow function specific behavior e.g. lexical bind this, arguments and etc.
This patch implements the simplest cases of arrow function declaration:
   parameters             () =&gt; 10 + 20
   parameter               x =&gt; x + 20
   parameters         (x, y) =&gt; x + y
   function with block     x =&gt; { return x*10; }

Not implemented:
   bind of the this, arguments, super and etc.
   exception in case of trying to use 'new' with arrow function

Patch by Aleksandr Skachkov &lt;gskachkov@gmail.com&gt; on 2015-06-26

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFunctionExpr):
(JSC::ASTBuilder::createArrowFunctionExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createFuncDeclStatement):
* parser/Lexer.cpp:
(JSC::Lexer&lt;T&gt;::setTokenPosition):
(JSC::Lexer&lt;T&gt;::lex):
* parser/Lexer.h:
(JSC::Lexer::lastTokenLocation):
(JSC::Lexer::setTerminator):
* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::parseInner):
(JSC::Parser&lt;LexerType&gt;::parseSourceElements):
(JSC::Parser&lt;LexerType&gt;::parseArrowFunctionSingleExpressionBody):
(JSC::Parser&lt;LexerType&gt;::parseSwitchClauses):
(JSC::Parser&lt;LexerType&gt;::parseSwitchDefaultClause):
(JSC::Parser&lt;LexerType&gt;::parseBlockStatement):
(JSC::Parser&lt;LexerType&gt;::parseFunctionBody):
(JSC::stringForFunctionMode):
(JSC::Parser&lt;LexerType&gt;::parseFunctionParameters):
(JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
(JSC::Parser&lt;LexerType&gt;::parseFunctionDeclaration):
(JSC::Parser&lt;LexerType&gt;::parseClass):
(JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
(JSC::Parser&lt;LexerType&gt;::parsePropertyMethod):
(JSC::Parser&lt;LexerType&gt;::parseGetterSetter):
(JSC::Parser&lt;LexerType&gt;::parseArrowFunctionExpression):
* parser/Parser.h:
(JSC::Parser::locationBeforeLastToken):
(JSC::Parser::isEndOfArrowFunction):
(JSC::Parser::isArrowFunctionParamters):
(JSC::Parser::setEndOfStatement):
* parser/ParserFunctionInfo.h:
* parser/ParserTokens.h:
* parser/SourceCode.h:
(JSC::SourceCode::subArrowExpression):
* parser/SourceProviderCacheItem.h:
(JSC::SourceProviderCacheItem::endFunctionToken):
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createArrowFunctionExpr):
(JSC::SyntaxChecker::setFunctionNameStart):

LayoutTests:
 [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function
 https://bugs.webkit.org/show_bug.cgi?id=144955

 Reviewed by Yusuke Suzuki.

 Added arrow function tests

Patch by Aleksandr Skachkov &lt;gskachkov@gmail.com&gt; on 2015-06-26

* js/arrowfunction-asparamter-1-expected.txt: Added.
* js/arrowfunction-asparamter-1.html: Added.
* js/arrowfunction-asparamter-2-expected.txt: Added.
* js/arrowfunction-asparamter-2.html: Added.
* js/arrowfunction-associativity-1-expected.txt: Added.
* js/arrowfunction-associativity-1.html: Added.
* js/arrowfunction-associativity-2-expected.txt: Added.
* js/arrowfunction-associativity-2.html: Added.
* js/arrowfunction-block-1-expected.txt: Added.
* js/arrowfunction-block-1.html: Added.
* js/arrowfunction-block-2-expected.txt: Added.
* js/arrowfunction-block-2.html: Added.
* js/arrowfunction-syntax-endings-expected.txt: Added.
* js/arrowfunction-syntax-endings.html: Added.
* js/arrowfunction-syntax-errors-expected.txt: Added.
* js/arrowfunction-syntax-errors.html: Added.
* js/arrowfunction-syntax-expected.txt: Added.
* js/arrowfunction-syntax.html: Added.
* js/script-tests/arrowfunction-asparamter-1.js: Added.
* js/script-tests/arrowfunction-asparamter-2.js: Added.
* js/script-tests/arrowfunction-associativity-1.js: Added.
* js/script-tests/arrowfunction-associativity-2.js: Added.
* js/script-tests/arrowfunction-block-1.js: Added.
* js/script-tests/arrowfunction-block-2.js: Added.
* js/script-tests/arrowfunction-syntax-endings.js: Added.
* js/script-tests/arrowfunction-syntax-errors.js: Added.
* js/script-tests/arrowfunction-syntax.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserASTBuilderh">trunk/Source/JavaScriptCore/parser/ASTBuilder.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserLexercpp">trunk/Source/JavaScriptCore/parser/Lexer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserLexerh">trunk/Source/JavaScriptCore/parser/Lexer.h</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>
<li><a href="#trunkSourceJavaScriptCoreparserParserFunctionInfoh">trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserTokensh">trunk/Source/JavaScriptCore/parser/ParserTokens.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserSourceCodeh">trunk/Source/JavaScriptCore/parser/SourceCode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserSourceProviderCacheItemh">trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserSyntaxCheckerh">trunk/Source/JavaScriptCore/parser/SyntaxChecker.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsarrowfunctionasparamter1expectedtxt">trunk/LayoutTests/js/arrowfunction-asparamter-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionasparamter1html">trunk/LayoutTests/js/arrowfunction-asparamter-1.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionasparamter2expectedtxt">trunk/LayoutTests/js/arrowfunction-asparamter-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionasparamter2html">trunk/LayoutTests/js/arrowfunction-asparamter-2.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionassociativity1expectedtxt">trunk/LayoutTests/js/arrowfunction-associativity-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionassociativity1html">trunk/LayoutTests/js/arrowfunction-associativity-1.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionassociativity2expectedtxt">trunk/LayoutTests/js/arrowfunction-associativity-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionassociativity2html">trunk/LayoutTests/js/arrowfunction-associativity-2.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionblock1expectedtxt">trunk/LayoutTests/js/arrowfunction-block-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionblock1html">trunk/LayoutTests/js/arrowfunction-block-1.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionblock2expectedtxt">trunk/LayoutTests/js/arrowfunction-block-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionblock2html">trunk/LayoutTests/js/arrowfunction-block-2.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxendingsexpectedtxt">trunk/LayoutTests/js/arrowfunction-syntax-endings-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxendingshtml">trunk/LayoutTests/js/arrowfunction-syntax-endings.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt">trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxerrorshtml">trunk/LayoutTests/js/arrowfunction-syntax-errors.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxexpectedtxt">trunk/LayoutTests/js/arrowfunction-syntax-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxhtml">trunk/LayoutTests/js/arrowfunction-syntax.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionasparamter1js">trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-1.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionasparamter2js">trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-2.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionassociativity1js">trunk/LayoutTests/js/script-tests/arrowfunction-associativity-1.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionassociativity2js">trunk/LayoutTests/js/script-tests/arrowfunction-associativity-2.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionblock1js">trunk/LayoutTests/js/script-tests/arrowfunction-block-1.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionblock2js">trunk/LayoutTests/js/script-tests/arrowfunction-block-2.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsyntaxendingsjs">trunk/LayoutTests/js/script-tests/arrowfunction-syntax-endings.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs">trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsyntaxjs">trunk/LayoutTests/js/script-tests/arrowfunction-syntax.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/LayoutTests/ChangeLog        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2015-06-26 Aleksandr Skachkov  &lt;gskachkov@gmail.com&gt;
+
+         [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function 
+         https://bugs.webkit.org/show_bug.cgi?id=144955
+
+         Reviewed by Yusuke Suzuki.
+
+         Added arrow function tests     
+
+        * js/arrowfunction-asparamter-1-expected.txt: Added.
+        * js/arrowfunction-asparamter-1.html: Added.
+        * js/arrowfunction-asparamter-2-expected.txt: Added.
+        * js/arrowfunction-asparamter-2.html: Added.
+        * js/arrowfunction-associativity-1-expected.txt: Added.
+        * js/arrowfunction-associativity-1.html: Added.
+        * js/arrowfunction-associativity-2-expected.txt: Added.
+        * js/arrowfunction-associativity-2.html: Added.
+        * js/arrowfunction-block-1-expected.txt: Added.
+        * js/arrowfunction-block-1.html: Added.
+        * js/arrowfunction-block-2-expected.txt: Added.
+        * js/arrowfunction-block-2.html: Added.
+        * js/arrowfunction-syntax-endings-expected.txt: Added.
+        * js/arrowfunction-syntax-endings.html: Added.
+        * js/arrowfunction-syntax-errors-expected.txt: Added.
+        * js/arrowfunction-syntax-errors.html: Added.
+        * js/arrowfunction-syntax-expected.txt: Added.
+        * js/arrowfunction-syntax.html: Added.
+        * js/script-tests/arrowfunction-asparamter-1.js: Added.
+        * js/script-tests/arrowfunction-asparamter-2.js: Added.
+        * js/script-tests/arrowfunction-associativity-1.js: Added.
+        * js/script-tests/arrowfunction-associativity-2.js: Added.
+        * js/script-tests/arrowfunction-block-1.js: Added.
+        * js/script-tests/arrowfunction-block-2.js: Added.
+        * js/script-tests/arrowfunction-syntax-endings.js: Added.
+        * js/script-tests/arrowfunction-syntax-errors.js: Added.
+        * js/script-tests/arrowfunction-syntax.js: Added.
+
</ins><span class="cx"> 2015-06-25  Chris Fleizach  &lt;cfleizach@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: improve list heuristics (presentational use versus actual lists)
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionasparamter1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-asparamter-1-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-asparamter-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-asparamter-1-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests for ES6 arrow function, passing arrow function as the paramter
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS &quot;&quot; + [1, 2, 3, 4].map(x =&gt; x, 32) is '1,2,3,4'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionasparamter1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-asparamter-1.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-asparamter-1.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-asparamter-1.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-asparamter-1.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionasparamter2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-asparamter-2-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-asparamter-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-asparamter-2-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests for ES6 arrow function, passing arrow function as the paramter
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS f(x=&gt;{return x * 25;}, 121) is 25*121
+PASS f2((x, y)=&gt;{return x * y;}, 14, 12) is 14*12
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionasparamter2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-asparamter-2.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-asparamter-2.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-asparamter-2.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-asparamter-2.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionassociativity1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-associativity-1-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-associativity-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-associativity-1-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests for ES6 arrow function nested declaration
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+af1 = af2 = af3 =&gt; af1 = af2 = af3
+PASS af1 is af2
+PASS af2 is 13
+PASS af1 is 13
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionassociativity1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-associativity-1.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-associativity-1.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-associativity-1.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-associativity-1.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionassociativity2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-associativity-2-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-associativity-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-associativity-2-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests for ES6 arrow function nested declaration
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+af = a =&gt; b =&gt; a
+PASS af('ABC')('DEF') is 'ABC'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionassociativity2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-associativity-2.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-associativity-2.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-associativity-2.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-associativity-2.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionblock1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-block-1-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-block-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-block-1-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Tests for ES6 arrow function declaration body as block
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+f = () =&gt; {}
+PASS typeof f() is 'undefined'
+g = () =&gt; ({})
+PASS typeof g() is 'object'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionblock1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-block-1.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-block-1.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-block-1.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-block-1.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionblock2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-block-2-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-block-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-block-2-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests for ES6 arrow function declaration body as block
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS typeof af(0) is &quot;undefined&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionblock2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-block-2.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-block-2.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-block-2.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-block-2.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxendingsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax-endings-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-endings-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax-endings-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Tests for ES6 arrow function endings
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS afEOL(12) is 13
+PASS x=&gt;x+1 did not throw exception.
+PASS x=&gt;x+1
+ did not throw exception.
+PASS f() is 39
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxendingshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax-endings.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-endings.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax-endings.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-syntax-endings.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+Tests for ES6 arrow function syntax errors
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS =&gt;{} threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS x=&gt; threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;* threw exception SyntaxError: Unexpected token '*'.
+PASS x=&gt;/ threw exception SyntaxError: Unexpected token '/'. Invalid regular expression..
+PASS x=&gt;% threw exception SyntaxError: Unexpected token '%'.
+PASS x=&gt;+ threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;- threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;&lt;&lt; threw exception SyntaxError: Unexpected token '&lt;&lt;'.
+PASS x=&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;'.
+PASS x=&gt;&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;&gt;'.
+PASS x=&gt;&lt; threw exception SyntaxError: Unexpected token '&lt;'.
+PASS x=&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;'.
+PASS x=&gt;&lt;= threw exception SyntaxError: Unexpected token '&lt;='.
+PASS x=&gt;&gt;= threw exception SyntaxError: Unexpected token '&gt;='.
+PASS x=&gt;instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
+PASS x=&gt;in threw exception SyntaxError: Unexpected keyword 'in'.
+PASS x=&gt;== threw exception SyntaxError: Unexpected token '=='.
+PASS x=&gt;!= threw exception SyntaxError: Unexpected token '!='.
+PASS x=&gt;=== threw exception SyntaxError: Unexpected token '==='.
+PASS x=&gt;!== threw exception SyntaxError: Unexpected token '!=='.
+PASS x=&gt;&amp; threw exception SyntaxError: Unexpected token '&amp;'.
+PASS x=&gt;^ threw exception SyntaxError: Unexpected token '^'.
+PASS x=&gt;| threw exception SyntaxError: Unexpected token '|'.
+PASS x=&gt;&amp;&amp; threw exception SyntaxError: Unexpected token '&amp;&amp;'.
+PASS x=&gt;|| threw exception SyntaxError: Unexpected token '||'.
+PASS x=&gt;; threw exception SyntaxError: Unexpected token ';'.
+PASS x=&gt;, threw exception SyntaxError: Unexpected token ','.
+PASS x=&gt;{ threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;{* threw exception SyntaxError: Unexpected token '*'.
+PASS x=&gt;{/ threw exception SyntaxError: Unexpected token '/'. Invalid regular expression..
+PASS x=&gt;{% threw exception SyntaxError: Unexpected token '%'.
+PASS x=&gt;{+ threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;{- threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;{&lt;&lt; threw exception SyntaxError: Unexpected token '&lt;&lt;'.
+PASS x=&gt;{&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;'.
+PASS x=&gt;{&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;&gt;'.
+PASS x=&gt;{&lt; threw exception SyntaxError: Unexpected token '&lt;'.
+PASS x=&gt;{&gt; threw exception SyntaxError: Unexpected token '&gt;'.
+PASS x=&gt;{&lt;= threw exception SyntaxError: Unexpected token '&lt;='.
+PASS x=&gt;{&gt;= threw exception SyntaxError: Unexpected token '&gt;='.
+PASS x=&gt;{instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
+PASS x=&gt;{in threw exception SyntaxError: Unexpected keyword 'in'.
+PASS x=&gt;{== threw exception SyntaxError: Unexpected token '=='.
+PASS x=&gt;{!= threw exception SyntaxError: Unexpected token '!='.
+PASS x=&gt;{=== threw exception SyntaxError: Unexpected token '==='.
+PASS x=&gt;{!== threw exception SyntaxError: Unexpected token '!=='.
+PASS x=&gt;{&amp; threw exception SyntaxError: Unexpected token '&amp;'.
+PASS x=&gt;{^ threw exception SyntaxError: Unexpected token '^'.
+PASS x=&gt;{| threw exception SyntaxError: Unexpected token '|'.
+PASS x=&gt;{&amp;&amp; threw exception SyntaxError: Unexpected token '&amp;&amp;'.
+PASS x=&gt;{|| threw exception SyntaxError: Unexpected token '||'.
+PASS x=&gt;{; threw exception SyntaxError: Unexpected end of script.
+PASS x=&gt;{, threw exception SyntaxError: Unexpected token ','.
+PASS x=&gt;} threw exception SyntaxError: Unexpected token '}'.
+PASS var y = x=&gt; threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;* threw exception SyntaxError: Unexpected token '*'.
+PASS var y = x=&gt;/ threw exception SyntaxError: Unexpected token '/'. Invalid regular expression..
+PASS var y = x=&gt;% threw exception SyntaxError: Unexpected token '%'.
+PASS var y = x=&gt;+ threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;- threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;&lt;&lt; threw exception SyntaxError: Unexpected token '&lt;&lt;'.
+PASS var y = x=&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;'.
+PASS var y = x=&gt;&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;&gt;'.
+PASS var y = x=&gt;&lt; threw exception SyntaxError: Unexpected token '&lt;'.
+PASS var y = x=&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;'.
+PASS var y = x=&gt;&lt;= threw exception SyntaxError: Unexpected token '&lt;='.
+PASS var y = x=&gt;&gt;= threw exception SyntaxError: Unexpected token '&gt;='.
+PASS var y = x=&gt;instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
+PASS var y = x=&gt;in threw exception SyntaxError: Unexpected keyword 'in'.
+PASS var y = x=&gt;== threw exception SyntaxError: Unexpected token '=='.
+PASS var y = x=&gt;!= threw exception SyntaxError: Unexpected token '!='.
+PASS var y = x=&gt;=== threw exception SyntaxError: Unexpected token '==='.
+PASS var y = x=&gt;!== threw exception SyntaxError: Unexpected token '!=='.
+PASS var y = x=&gt;&amp; threw exception SyntaxError: Unexpected token '&amp;'.
+PASS var y = x=&gt;^ threw exception SyntaxError: Unexpected token '^'.
+PASS var y = x=&gt;| threw exception SyntaxError: Unexpected token '|'.
+PASS var y = x=&gt;&amp;&amp; threw exception SyntaxError: Unexpected token '&amp;&amp;'.
+PASS var y = x=&gt;|| threw exception SyntaxError: Unexpected token '||'.
+PASS var y = x=&gt;; threw exception SyntaxError: Unexpected token ';'.
+PASS var y = x=&gt;, threw exception SyntaxError: Unexpected token ','.
+PASS var y = x=&gt;{ threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;{* threw exception SyntaxError: Unexpected token '*'.
+PASS var y = x=&gt;{/ threw exception SyntaxError: Unexpected token '/'. Invalid regular expression..
+PASS var y = x=&gt;{% threw exception SyntaxError: Unexpected token '%'.
+PASS var y = x=&gt;{+ threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;{- threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;{&lt;&lt; threw exception SyntaxError: Unexpected token '&lt;&lt;'.
+PASS var y = x=&gt;{&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;'.
+PASS var y = x=&gt;{&gt;&gt;&gt; threw exception SyntaxError: Unexpected token '&gt;&gt;&gt;'.
+PASS var y = x=&gt;{&lt; threw exception SyntaxError: Unexpected token '&lt;'.
+PASS var y = x=&gt;{&gt; threw exception SyntaxError: Unexpected token '&gt;'.
+PASS var y = x=&gt;{&lt;= threw exception SyntaxError: Unexpected token '&lt;='.
+PASS var y = x=&gt;{&gt;= threw exception SyntaxError: Unexpected token '&gt;='.
+PASS var y = x=&gt;{instanceof threw exception SyntaxError: Unexpected keyword 'instanceof'.
+PASS var y = x=&gt;{in threw exception SyntaxError: Unexpected keyword 'in'.
+PASS var y = x=&gt;{== threw exception SyntaxError: Unexpected token '=='.
+PASS var y = x=&gt;{!= threw exception SyntaxError: Unexpected token '!='.
+PASS var y = x=&gt;{=== threw exception SyntaxError: Unexpected token '==='.
+PASS var y = x=&gt;{!== threw exception SyntaxError: Unexpected token '!=='.
+PASS var y = x=&gt;{&amp; threw exception SyntaxError: Unexpected token '&amp;'.
+PASS var y = x=&gt;{^ threw exception SyntaxError: Unexpected token '^'.
+PASS var y = x=&gt;{| threw exception SyntaxError: Unexpected token '|'.
+PASS var y = x=&gt;{&amp;&amp; threw exception SyntaxError: Unexpected token '&amp;&amp;'.
+PASS var y = x=&gt;{|| threw exception SyntaxError: Unexpected token '||'.
+PASS var y = x=&gt;{; threw exception SyntaxError: Unexpected end of script.
+PASS var y = x=&gt;{, threw exception SyntaxError: Unexpected token ','.
+PASS var y = x=&gt;} threw exception SyntaxError: Unexpected token '}'.
+PASS var t = x=&gt;x+1; =&gt;{} threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS [=&gt;x+1] threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS [x=&gt;x+1, =&gt;x+1] threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS var f=&gt;x+1; threw exception SyntaxError: Unexpected keyword '=&gt;'. Expected ';' after var declaration..
+PASS var x, y=&gt;y+1; threw exception SyntaxError: Unexpected keyword '=&gt;'. Expected ';' after var declaration..
+PASS debug(=&gt;x+1) threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS debug(&quot;xyz&quot;, =&gt;x+1) threw exception SyntaxError: Unexpected keyword '=&gt;'.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxerrorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax-errors.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-errors.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax-errors.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-syntax-errors.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax-expected.txt (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax-expected.txt        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+Tests for ES6 arrow function calling
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS af0(10) is 11
+PASS af1(10) is 20
+PASS af2(1212) is 1000
+PASS af2_1(121) is a
+PASS af3(11,12) is 23
+PASS afwrapper(x =&gt; 1234) is 1234
+PASS afwrapper(x =&gt; 1234, 2345) is 1234
+PASS afwrapper(x =&gt; 121 + 232) is 353
+PASS afwrapper(x =&gt; 123 + 321, 9999) is 444
+PASS afwrapper(x =&gt; x + 12, 21) is 33
+PASS afwrapper((x) =&gt; x + 21, 32) is 53
+PASS afwrapper(() =&gt; 100) is 100
+PASS afwrapper(() =&gt; ext_value) is 121
+PASS afwrapper(() =&gt; ext_value * 10) is 1210
+PASS afwrapper((x) =&gt; ext_value * x, 30) is ext_value * 30
+PASS afwrapper(() =&gt; 100, 11) is 100
+PASS afwrapper(() =&gt; 100 + 10) is 110
+PASS afwrapper(() =&gt; 100 + 11, 12) is 111
+PASS arrowFunction4(1011) is 1012
+PASS xyz1 is 10101
+PASS afwrapper2((x, y) =&gt; x + y, 12 ,43) is 55
+PASS afArr0[0](10) is 100
+PASS afArr1[0](10) is 11
+PASS afArr1[1](11) is 13
+PASS afArr2[0](11) is 12
+PASS afArr2[1](11) is 13
+PASS afArr3[0](11) is 101
+PASS afArr3[1](11) is 12323
+PASS afObj.func(11) is 23
+PASS afBlock0(11) is 1000
+PASS afBlock1(11) is 1100
+PASS afBlock2(11) is 2200
+PASS afBlock3(11, 12222) is 134442
+PASS (function funcSelfExecAE1(value) { var f = x =&gt; x+1; return f(value);})(123); is 124
+PASS (function funcSelfExecAE2(value) { var f = x =&gt; { x++; return x + 1; }; return f(value);})(123); is 125
+PASS (function funcSelfExecAE3(value) { var f = (x) =&gt; { x++; return x + 1; }; return f(value);})(123); is 125
+PASS (function funcSelfExecAE4(value) { var f = (x, y) =&gt; { x++; return x + y; }; return f(value, value * 2);})(123); is 370
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-syntax.html (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-syntax.html        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-syntax.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionasparamter1js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-1.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-1.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-1.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+description('Tests for ES6 arrow function, passing arrow function as the paramter');
+
+shouldBe('&quot;&quot; + [1, 2, 3, 4].map(x =&gt; x, 32)', &quot;'1,2,3,4'&quot;);
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionasparamter2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-2.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-2.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-asparamter-2.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+description('Tests for ES6 arrow function, passing arrow function as the paramter');
+
+var f = function (cl, paramter) { return cl(paramter); };
+var f2 = function (cl, paramter1, paramter2) { return cl(paramter1, paramter2); };
+
+shouldBe('f(x=&gt;{return x * 25;}, 121)', '25*121' );
+shouldBe('f2((x, y)=&gt;{return x * y;}, 14, 12)', '14*12');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionassociativity1js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-associativity-1.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-associativity-1.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-associativity-1.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+description('Tests for ES6 arrow function nested declaration');
+
+var af1, af2, af3;
+af1 = af2 = af3 =&gt; af1 = af2 = af3;
+debug('af1 = af2 = af3 =&gt; af1 = af2 = af3')
+shouldBe('af1', 'af2');
+af1(13);
+shouldBe('af2', '13');
+shouldBe('af1', '13');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionassociativity2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-associativity-2.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-associativity-2.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-associativity-2.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+description('Tests for ES6 arrow function nested declaration');
+
+debug(&quot;af = a =&gt; b =&gt; a&quot;)
+var af = a =&gt; b =&gt; a;
+
+shouldBe(&quot;af('ABC')('DEF')&quot;, &quot;'ABC'&quot;);
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionblock1js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-block-1.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-block-1.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-block-1.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+description('Tests for ES6 arrow function declaration body as block');
+
+debug('f = () =&gt; {}');
+var f = () =&gt; {};
+shouldBe(&quot;typeof f()&quot;, &quot;'undefined'&quot;);
+
+debug('g = () =&gt; ({})');
+var g = () =&gt; ({});
+shouldBe(&quot;typeof g()&quot;, &quot;'object'&quot;);
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionblock2js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-block-2.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-block-2.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-block-2.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+description('Tests for ES6 arrow function declaration body as block');
+
+var af = a =&gt; { a + 1; };
+
+shouldBe(&quot;typeof af(0)&quot;, '&quot;undefined&quot;');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsyntaxendingsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-syntax-endings.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-syntax-endings.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-syntax-endings.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+description(&quot;Tests for ES6 arrow function endings&quot;);
+
+var afEOL = x=&gt;x+1
+result = afEOL(12);
+
+shouldBe('afEOL(12)', '13');
+
+shouldNotThrow('x=&gt;x+1');
+
+var afEOLTxt = 'x=&gt;x+1' + String.fromCharCode(10);
+shouldNotThrow(afEOLTxt);
+
+var f = function () {
+  var result = 0;
+  var afEOF;
+
+
+  afEOF = x =&gt; x*10000 + x*1000 - x*10000 - x*1000 + x
+
+
+
+  result = afEOF(12);
+
+
+  result = result + afEOF(13);
+
+
+  result = result + afEOF(14);
+
+  return result;
+};
+
+shouldBe('f()', '39');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+description(&quot;Tests for ES6 arrow function syntax errors&quot;);
+
+shouldThrow('=&gt;{}');
+
+function checkStatement(statement) {
+  var unexpectedSymbols = [ &quot;&quot;,
+      &quot;*&quot;, &quot;/&quot;, &quot;%&quot; ,  &quot;+&quot;, &quot;-&quot; ,
+       &quot;&lt;&lt;&quot;, &quot;&gt;&gt;&quot;, &quot;&gt;&gt;&gt;&quot; ,
+       &quot;&lt;&quot;, &quot;&gt;&quot;, &quot;&lt;=&quot;, &quot;&gt;=&quot;, &quot;instanceof&quot;, &quot;in&quot; ,
+       &quot;==&quot;, &quot;!=&quot;, &quot;===&quot;, &quot;!==&quot;,
+       &quot;&amp;&quot; ,  &quot;^&quot; ,  &quot;|&quot; ,
+       &quot;&amp;&amp;&quot; ,  &quot;||&quot;, &quot;;&quot; , &quot;,&quot;
+  ];
+
+  for (var i = 0; i &lt; unexpectedSymbols.length; i++) {
+    shouldThrow(statement + unexpectedSymbols[i]);
+  }
+}
+
+checkStatement('x=&gt;');
+checkStatement('x=&gt;{');
+shouldThrow('x=&gt;}');
+
+checkStatement('var y = x=&gt;');
+checkStatement('var y = x=&gt;{');
+shouldThrow('var y = x=&gt;}');
+
+
+shouldThrow('var t = x=&gt;x+1; =&gt;{}');
+shouldThrow('[=&gt;x+1]');
+shouldThrow('[x=&gt;x+1, =&gt;x+1]');
+shouldThrow('var f=&gt;x+1;');
+shouldThrow('var x, y=&gt;y+1;');
+shouldThrow('debug(=&gt;x+1)');
+shouldThrow('debug(&quot;xyz&quot;, =&gt;x+1)');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsyntaxjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-syntax.js (0 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-syntax.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-syntax.js        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+description(&quot;Tests for ES6 arrow function calling&quot;);
+
+var af0 = v =&gt; v + 1;
+shouldBe('af0(10)', '11');
+
+var af1 = (v) =&gt; v * 2;
+shouldBe('af1(10)', '20');
+
+var af2 = () =&gt; 1000;
+shouldBe('af2(1212)', '1000' );
+
+var a = 151;
+var af2_1 = () =&gt; a;
+shouldBe('af2_1(121)', 'a');
+
+var af3 = (v, x) =&gt; v + x;
+shouldBe('af3(11,12)', '23');
+
+var afwrapper = function (cl, paramter) { return cl(paramter); };
+
+shouldBe('afwrapper(x =&gt; 1234)', '1234');
+shouldBe('afwrapper(x =&gt; 1234, 2345)', '1234' );
+shouldBe('afwrapper(x =&gt; 121 + 232)', '353' );
+shouldBe('afwrapper(x =&gt; 123 + 321, 9999)', '444' );
+shouldBe('afwrapper(x =&gt; x + 12, 21)', '33' );
+shouldBe('afwrapper((x) =&gt; x + 21, 32)', '53');
+shouldBe('afwrapper(() =&gt; 100)', '100');
+
+var ext_value = 121;
+shouldBe('afwrapper(() =&gt; ext_value)', '121');
+shouldBe('afwrapper(() =&gt; ext_value * 10)', '1210');
+shouldBe('afwrapper((x) =&gt; ext_value * x, 30)', 'ext_value * 30');
+shouldBe('afwrapper(() =&gt; 100, 11)', '100' );
+shouldBe('afwrapper(() =&gt; 100 + 10)', '110');
+shouldBe('afwrapper(() =&gt; 100 + 11, 12)', '111' );
+
+var arrowFunction4 = v =&gt; v + 1, xyz1 = 10101;
+shouldBe('arrowFunction4(1011)', '1012');
+shouldBe('xyz1', '10101');
+
+var afwrapper2 = function (cl, paramter1, paramter2) { return cl(paramter1, paramter2); };
+shouldBe('afwrapper2((x, y) =&gt; x + y, 12 ,43)', '55');
+
+var afArr0 = [v =&gt; v * 10];
+shouldBe('afArr0[0](10)', '100');
+
+var afArr1 = [v =&gt; v + 1, v =&gt; v + 2];
+shouldBe('afArr1[0](10)', '11');
+shouldBe('afArr1[1](11)', '13');
+
+var afArr2 = [(v) =&gt; v + 1, (v) =&gt; v + 2];
+shouldBe('afArr2[0](11)', '12');
+shouldBe('afArr2[1](11)', '13');
+
+var afArr3 = [() =&gt; 101, () =&gt; 12323];
+shouldBe('afArr3[0](11)', '101');
+shouldBe('afArr3[1](11)', '12323');
+
+var afObj = {func : y =&gt; y + 12};
+shouldBe('afObj.func(11)', '23');
+
+var afBlock0 = () =&gt; { return 1000; };
+shouldBe('afBlock0(11)', '1000');
+
+var afBlock1 = v =&gt; { var intval = 100; return v * intval; };
+shouldBe('afBlock1(11)', '1100');
+
+var afBlock2 = (v) =&gt; { var int = 200; return v * int; };
+shouldBe('afBlock2(11)', '2200');
+
+var afBlock3 = (v, x) =&gt; { var result = x * v; return result; };
+shouldBe('afBlock3(11, 12222)', '134442');
+
+shouldBe('(function funcSelfExecAE1(value) { var f = x =&gt; x+1; return f(value);})(123);', '124');
+
+shouldBe('(function funcSelfExecAE2(value) { var f = x =&gt; { x++; return x + 1; }; return f(value);})(123);', '125');
+
+shouldBe('(function funcSelfExecAE3(value) { var f = (x) =&gt; { x++; return x + 1; }; return f(value);})(123);', '125');
+
+shouldBe('(function funcSelfExecAE4(value) { var f = (x, y) =&gt; { x++; return x + y; }; return f(value, value * 2);})(123);', '370');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2015-06-26 Aleksandr Skachkov  &lt;gskachkov@gmail.com&gt;
+
+         [ES6] Implement ES6 arrow function syntax. Parser of arrow function with execution as common function. 
+         https://bugs.webkit.org/show_bug.cgi?id=144955
+
+         Reviewed by Yusuke Suzuki.
+
+         Added support of ES6 arrow function. Changes were made according to following spec http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax. Patch does not include any arrow function specific behavior e.g. lexical bind this, arguments and etc.     
+        This patch implements the simplest cases of arrow function declaration:
+           parameters             () =&gt; 10 + 20
+           parameter               x =&gt; x + 20
+           parameters         (x, y) =&gt; x + y
+           function with block     x =&gt; { return x*10; }
+
+        Not implemented:
+           bind of the this, arguments, super and etc.
+           exception in case of trying to use 'new' with arrow function
+
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::createFunctionExpr):
+        (JSC::ASTBuilder::createArrowFunctionExpr):
+        (JSC::ASTBuilder::createGetterOrSetterProperty):
+        (JSC::ASTBuilder::createFuncDeclStatement):
+        * parser/Lexer.cpp:
+        (JSC::Lexer&lt;T&gt;::setTokenPosition):
+        (JSC::Lexer&lt;T&gt;::lex):
+        * parser/Lexer.h:
+        (JSC::Lexer::lastTokenLocation):
+        (JSC::Lexer::setTerminator):
+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::parseInner):
+        (JSC::Parser&lt;LexerType&gt;::parseSourceElements):
+        (JSC::Parser&lt;LexerType&gt;::parseArrowFunctionSingleExpressionBody):
+        (JSC::Parser&lt;LexerType&gt;::parseSwitchClauses):
+        (JSC::Parser&lt;LexerType&gt;::parseSwitchDefaultClause):
+        (JSC::Parser&lt;LexerType&gt;::parseBlockStatement):
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionBody):
+        (JSC::stringForFunctionMode):
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionParameters):
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionDeclaration):
+        (JSC::Parser&lt;LexerType&gt;::parseClass):
+        (JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
+        (JSC::Parser&lt;LexerType&gt;::parsePropertyMethod):
+        (JSC::Parser&lt;LexerType&gt;::parseGetterSetter):
+        (JSC::Parser&lt;LexerType&gt;::parseArrowFunctionExpression):
+        * parser/Parser.h:
+        (JSC::Parser::locationBeforeLastToken):
+        (JSC::Parser::isEndOfArrowFunction):
+        (JSC::Parser::isArrowFunctionParamters):
+        (JSC::Parser::setEndOfStatement):
+        * parser/ParserFunctionInfo.h:
+        * parser/ParserTokens.h:
+        * parser/SourceCode.h:
+        (JSC::SourceCode::subArrowExpression):
+        * parser/SourceProviderCacheItem.h:
+        (JSC::SourceProviderCacheItem::endFunctionToken):
+        (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::createArrowFunctionExpr):
+        (JSC::SyntaxChecker::setFunctionNameStart):
+
</ins><span class="cx"> 2015-06-25  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Support rest element in destructuring assignments
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserASTBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ASTBuilder.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -347,7 +347,7 @@
</span><span class="cx">     ExpressionNode* createFunctionExpr(const JSTokenLocation&amp; location, const ParserFunctionInfo&lt;ASTBuilder&gt;&amp; info)
</span><span class="cx">     {
</span><span class="cx">         FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body,
</span><del>-            m_sourceCode-&gt;subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
</del><ins>+            m_sourceCode-&gt;subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
</ins><span class="cx">         info.body-&gt;setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="lines">@@ -364,13 +364,26 @@
</span><span class="cx">             inStrictContext, constructorKind);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    ExpressionNode* createArrowFunctionExpr(const JSTokenLocation&amp; location, const ParserFunctionInfo&lt;ASTBuilder&gt;&amp; info)
+    {
+        SourceCode source = info.functionBodyType == ArrowFunctionBodyExpression
+            ? m_sourceCode-&gt;subArrowExpression(info.arrowFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn)
+            : m_sourceCode-&gt;subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
+
+        FuncExprNode* result = new (m_parserArena) FuncExprNode(location, *info.name, info.body, source, info.parameters);
+        info.body-&gt;setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
+        return result;
+    }
+#endif
+
</ins><span class="cx">     NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation&amp; location, PropertyNode::Type type, bool,
</span><span class="cx">         const Identifier* name, const ParserFunctionInfo&lt;ASTBuilder&gt;&amp; info, SuperBinding superBinding)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(name);
</span><span class="cx">         info.body-&gt;setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
</span><span class="cx">         info.body-&gt;setInferredName(*name);
</span><del>-        SourceCode source = m_sourceCode-&gt;subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn);
</del><ins>+        SourceCode source = m_sourceCode-&gt;subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
</ins><span class="cx">         FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, m_vm-&gt;propertyNames-&gt;nullIdentifier, info.body, source, info.parameters);
</span><span class="cx">         return new (m_parserArena) PropertyNode(*name, funcExpr, type, PropertyNode::Unknown, superBinding);
</span><span class="cx">     }
</span><span class="lines">@@ -380,7 +393,7 @@
</span><span class="cx">     {
</span><span class="cx">         info.body-&gt;setLoc(info.bodyStartLine, info.bodyEndLine, location.startOffset, location.lineStartOffset);
</span><span class="cx">         const Identifier&amp; ident = parserArena.identifierArena().makeNumericIdentifier(vm, name);
</span><del>-        SourceCode source = m_sourceCode-&gt;subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn);
</del><ins>+        SourceCode source = m_sourceCode-&gt;subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn);
</ins><span class="cx">         FuncExprNode* funcExpr = new (m_parserArena) FuncExprNode(location, vm-&gt;propertyNames-&gt;nullIdentifier, info.body, source, info.parameters);
</span><span class="cx">         return new (m_parserArena) PropertyNode(ident, funcExpr, type, PropertyNode::Unknown, superBinding);
</span><span class="cx">     }
</span><span class="lines">@@ -417,7 +430,7 @@
</span><span class="cx">     StatementNode* createFuncDeclStatement(const JSTokenLocation&amp; location, const ParserFunctionInfo&lt;ASTBuilder&gt;&amp; info)
</span><span class="cx">     {
</span><span class="cx">         FuncDeclNode* decl = new (m_parserArena) FuncDeclNode(location, *info.name, info.body,
</span><del>-            m_sourceCode-&gt;subExpression(info.openBraceOffset, info.closeBraceOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
</del><ins>+            m_sourceCode-&gt;subExpression(info.startFunctionOffset, info.endFunctionOffset, info.bodyStartLine, info.bodyStartColumn), info.parameters);
</ins><span class="cx">         if (*info.name == m_vm-&gt;propertyNames-&gt;arguments)
</span><span class="cx">             usesArguments();
</span><span class="cx">         m_scope.m_funcDeclarations.append(decl-&gt;body());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserLexercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Lexer.cpp (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Lexer.cpp        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/Lexer.cpp        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -1715,11 +1715,25 @@
</span><span class="cx">     return code &lt; m_codeEnd &amp;&amp; *code == ':';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
</ins><span class="cx"> template &lt;typename T&gt;
</span><ins>+void Lexer&lt;T&gt;::setTokenPosition(JSToken* tokenRecord)
+{
+    JSTokenData* tokenData = &amp;tokenRecord-&gt;m_data;
+    tokenData-&gt;line = lineNumber();
+    tokenData-&gt;offset = currentOffset();
+    tokenData-&gt;lineStartOffset = currentLineStartOffset();
+    ASSERT(tokenData-&gt;offset &gt;= tokenData-&gt;lineStartOffset);
+}
+#endif
+
+template &lt;typename T&gt;
</ins><span class="cx"> JSTokenType Lexer&lt;T&gt;::lex(JSToken* tokenRecord, unsigned lexerFlags, bool strictMode)
</span><span class="cx"> {
</span><span class="cx">     JSTokenData* tokenData = &amp;tokenRecord-&gt;m_data;
</span><span class="cx">     JSTokenLocation* tokenLocation = &amp;tokenRecord-&gt;m_location;
</span><ins>+    m_lastTockenLocation = JSTokenLocation(tokenRecord-&gt;m_location);
+    
</ins><span class="cx">     ASSERT(!m_error);
</span><span class="cx">     ASSERT(m_buffer8.isEmpty());
</span><span class="cx">     ASSERT(m_buffer16.isEmpty());
</span><span class="lines">@@ -1778,7 +1792,19 @@
</span><span class="cx">         }
</span><span class="cx">         token = GT;
</span><span class="cx">         break;
</span><del>-    case CharacterEqual:
</del><ins>+    case CharacterEqual: {
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+        if (peek(1) == '&gt;') {
+            token = ARROWFUNCTION;
+            tokenData-&gt;line = lineNumber();
+            tokenData-&gt;offset = currentOffset();
+            tokenData-&gt;lineStartOffset = currentLineStartOffset();
+            ASSERT(tokenData-&gt;offset &gt;= tokenData-&gt;lineStartOffset);
+            shift();
+            shift();
+            break;
+        }
+#endif
</ins><span class="cx">         shift();
</span><span class="cx">         if (m_current == '=') {
</span><span class="cx">             shift();
</span><span class="lines">@@ -1792,6 +1818,7 @@
</span><span class="cx">         }
</span><span class="cx">         token = EQUAL;
</span><span class="cx">         break;
</span><ins>+    }
</ins><span class="cx">     case CharacterLess:
</span><span class="cx">         shift();
</span><span class="cx">         if (m_current == '!' &amp;&amp; peek(1) == '-' &amp;&amp; peek(2) == '-') {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserLexerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Lexer.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Lexer.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/Lexer.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -87,6 +87,9 @@
</span><span class="cx">     void setIsReparsing() { m_isReparsing = true; }
</span><span class="cx">     bool isReparsing() const { return m_isReparsing; }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    void setTokenPosition(JSToken* tokenRecord);
+#endif
</ins><span class="cx">     JSTokenType lex(JSToken*, unsigned, bool strictMode);
</span><span class="cx">     bool nextTokenIsColon();
</span><span class="cx">     int lineNumber() const { return m_lineNumber; }
</span><span class="lines">@@ -97,6 +100,7 @@
</span><span class="cx">         return JSTextPosition(m_lineNumber, currentOffset(), currentLineStartOffset());
</span><span class="cx">     }
</span><span class="cx">     JSTextPosition positionBeforeLastNewline() const { return m_positionBeforeLastNewline; }
</span><ins>+    JSTokenLocation lastTokenLocation() const { return m_lastTockenLocation; }
</ins><span class="cx">     void setLastLineNumber(int lastLineNumber) { m_lastLineNumber = lastLineNumber; }
</span><span class="cx">     int lastLineNumber() const { return m_lastLineNumber; }
</span><span class="cx">     bool prevTerminator() const { return m_terminator; }
</span><span class="lines">@@ -131,6 +135,10 @@
</span><span class="cx">     {
</span><span class="cx">         m_lineNumber = line;
</span><span class="cx">     }
</span><ins>+    void setTerminator(bool terminator)
+    {
+        m_terminator = terminator;
+    }
</ins><span class="cx"> 
</span><span class="cx">     SourceProvider* sourceProvider() const { return m_source-&gt;provider(); }
</span><span class="cx"> 
</span><span class="lines">@@ -215,6 +223,7 @@
</span><span class="cx">     const T* m_codeStartPlusOffset;
</span><span class="cx">     const T* m_lineStart;
</span><span class="cx">     JSTextPosition m_positionBeforeLastNewline;
</span><ins>+    JSTokenLocation m_lastTockenLocation;
</ins><span class="cx">     bool m_isReparsing;
</span><span class="cx">     bool m_atLineStart;
</span><span class="cx">     bool m_error;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -264,7 +264,7 @@
</span><span class="cx">     if (m_lexer-&gt;isReparsing())
</span><span class="cx">         m_statementDepth--;
</span><span class="cx">     ScopeRef scope = currentScope();
</span><del>-    SourceElements* sourceElements = parseSourceElements(context, CheckForStrictMode);
</del><ins>+    SourceElements* sourceElements = parseSourceElements(context, CheckForStrictMode, StandardFunctionParseType);
</ins><span class="cx">     if (!sourceElements || !consume(EOFTOK)) {
</span><span class="cx">         if (hasError())
</span><span class="cx">             parseError = m_errorMessage;
</span><span class="lines">@@ -343,7 +343,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; TreeSourceElements Parser&lt;LexerType&gt;::parseSourceElements(TreeBuilder&amp; context, SourceElementsMode mode)
</del><ins>+template &lt;class TreeBuilder&gt; TreeSourceElements Parser&lt;LexerType&gt;::parseSourceElements(TreeBuilder&amp; context, SourceElementsMode mode, FunctionParseType functionParseType)
</ins><span class="cx"> {
</span><span class="cx">     const unsigned lengthOfUseStrictLiteral = 12; // &quot;use strict&quot;.length
</span><span class="cx">     TreeSourceElements sourceElements = context.createSourceElements();
</span><span class="lines">@@ -352,6 +352,21 @@
</span><span class="cx">     unsigned directiveLiteralLength = 0;
</span><span class="cx">     auto savePoint = createSavePoint();
</span><span class="cx">     bool hasSetStrict = false;
</span><ins>+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    if (match(ARROWFUNCTION)) {
+        TreeStatement arrowfunctionStatement = parseArrowFunctionSingleExpressionBody(context, functionParseType);
+            
+        if (arrowfunctionStatement) {
+            context.setEndOffset(arrowfunctionStatement, m_lastTokenEndPosition.offset);
+            context.appendStatement(sourceElements, arrowfunctionStatement);
+        }
+        
+        propagateError();
+        return sourceElements;
+    }
+#endif
+    
</ins><span class="cx">     while (TreeStatement statement = parseStatement(context, directive, &amp;directiveLiteralLength)) {
</span><span class="cx">         if (mode == CheckForStrictMode &amp;&amp; !seenNonDirective) {
</span><span class="cx">             if (directive) {
</span><span class="lines">@@ -583,7 +598,43 @@
</span><span class="cx">     return context.createBindingLocation(token.m_location, name, token.m_startPosition, token.m_endPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
</ins><span class="cx"> template &lt;typename LexerType&gt;
</span><ins>+template &lt;class TreeBuilder&gt; TreeStatement Parser&lt;LexerType&gt;::parseArrowFunctionSingleExpressionBody(TreeBuilder&amp; context, FunctionParseType parseType)
+{
+    ASSERT(match(ARROWFUNCTION));
+
+    // When reparsing phase, parseType becomes StandardFunctionParseType even if the function is arrow function.
+    // This condition considers the following situations.
+    // (1): If we are in the reparsing phase, this arrow function is already parsed once, so there is no syntax error.
+    // (2): But if we are not in the reparsing phase, we should check this function is called in the context of the arrow function.
+    if (!m_lexer-&gt;isReparsing() &amp;&amp; parseType != ArrowFunctionParseType)
+        failDueToUnexpectedToken();
+    
+    JSTokenLocation location(tokenLocation());
+    JSTextPosition start = tokenStartPosition();
+    JSTextPosition end = tokenEndPosition();
+
+    next();
+
+    failIfStackOverflow();
+    TreeExpression expr = parseAssignmentExpression(context);
+    failIfFalse(expr, &quot;Cannot parse the arrow function expression&quot;);
+    
+    context.setEndOffset(expr, m_lastTokenEndPosition.offset);
+
+    failIfFalse(isEndOfArrowFunction(), &quot;Expected a ';', ']', '}', ')', ',', line terminator or EOF following a arrow function statement&quot;);
+
+    end = tokenEndPosition();
+    
+    if (!m_lexer-&gt;prevTerminator())
+        setEndOfStatement();
+
+    return context.createReturnStatement(location, expr, start, end);
+}
+#endif
+
+template &lt;typename LexerType&gt;
</ins><span class="cx"> template &lt;class TreeBuilder&gt; TreeDeconstructionPattern Parser&lt;LexerType&gt;::tryParseDeconstructionPatternExpression(TreeBuilder&amp; context)
</span><span class="cx"> {
</span><span class="cx">     return parseDeconstructionPattern(context, DeconstructToExpressions);
</span><span class="lines">@@ -1065,7 +1116,7 @@
</span><span class="cx">     TreeExpression condition = parseExpression(context);
</span><span class="cx">     failIfFalse(condition, &quot;Cannot parse switch clause&quot;);
</span><span class="cx">     consumeOrFail(COLON, &quot;Expected a ':' after switch clause expression&quot;);
</span><del>-    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
</del><ins>+    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
</ins><span class="cx">     failIfFalse(statements, &quot;Cannot parse the body of a switch clause&quot;);
</span><span class="cx">     TreeClause clause = context.createClause(condition, statements);
</span><span class="cx">     context.setStartOffset(clause, startOffset);
</span><span class="lines">@@ -1078,7 +1129,7 @@
</span><span class="cx">         TreeExpression condition = parseExpression(context);
</span><span class="cx">         failIfFalse(condition, &quot;Cannot parse switch case expression&quot;);
</span><span class="cx">         consumeOrFail(COLON, &quot;Expected a ':' after switch clause expression&quot;);
</span><del>-        TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
</del><ins>+        TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
</ins><span class="cx">         failIfFalse(statements, &quot;Cannot parse the body of a switch clause&quot;);
</span><span class="cx">         clause = context.createClause(condition, statements);
</span><span class="cx">         context.setStartOffset(clause, startOffset);
</span><span class="lines">@@ -1095,7 +1146,7 @@
</span><span class="cx">     unsigned startOffset = tokenStart();
</span><span class="cx">     next();
</span><span class="cx">     consumeOrFail(COLON, &quot;Expected a ':' after switch default clause&quot;);
</span><del>-    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode);
</del><ins>+    TreeSourceElements statements = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
</ins><span class="cx">     failIfFalse(statements, &quot;Cannot parse the body of a switch default clause&quot;);
</span><span class="cx">     TreeClause result = context.createClause(0, statements);
</span><span class="cx">     context.setStartOffset(result, startOffset);
</span><span class="lines">@@ -1180,7 +1231,7 @@
</span><span class="cx">         context.setEndOffset(result, endOffset);
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><del>-    TreeSourceElements subtree = parseSourceElements(context, DontCheckForStrictMode);
</del><ins>+    TreeSourceElements subtree = parseSourceElements(context, DontCheckForStrictMode, StandardFunctionParseType);
</ins><span class="cx">     failIfFalse(subtree, &quot;Cannot parse the body of the block statement&quot;);
</span><span class="cx">     matchOrFail(CLOSEBRACE, &quot;Expected a closing '}' at the end of a block statement&quot;);
</span><span class="cx">     int endOffset = m_token.m_data.offset;
</span><span class="lines">@@ -1201,6 +1252,7 @@
</span><span class="cx">     failIfStackOverflow();
</span><span class="cx">     TreeStatement result = 0;
</span><span class="cx">     bool shouldSetEndOffset = true;
</span><ins>+
</ins><span class="cx">     switch (m_token.m_type) {
</span><span class="cx">     case OPENBRACE:
</span><span class="cx">         result = parseBlockStatement(context);
</span><span class="lines">@@ -1310,20 +1362,27 @@
</span><span class="cx"> template &lt;typename LexerType&gt;
</span><span class="cx"> template &lt;class TreeBuilder&gt; TreeFunctionBody Parser&lt;LexerType&gt;::parseFunctionBody(
</span><span class="cx">     TreeBuilder&amp; context, int functionKeywordStart, int functionNameStart, 
</span><del>-    int parametersStart, ConstructorKind constructorKind)
</del><ins>+    int parametersStart, ConstructorKind constructorKind, FunctionParseType parseType)
</ins><span class="cx"> {
</span><span class="cx">     JSTokenLocation startLocation(tokenLocation());
</span><span class="cx">     unsigned startColumn = tokenColumn();
</span><del>-    next();
</del><span class="cx"> 
</span><del>-    if (match(CLOSEBRACE)) {
-        unsigned endColumn = tokenColumn();
-        return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
</del><ins>+    if (parseType == StandardFunctionParseType) {
+        next();
+        if (match(CLOSEBRACE)) {
+            unsigned endColumn = tokenColumn();
+            return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
+        }
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     DepthManager statementDepth(&amp;m_statementDepth);
</span><span class="cx">     m_statementDepth = 0;
</span><span class="cx">     typename TreeBuilder::FunctionBodyBuilder bodyBuilder(const_cast&lt;VM*&gt;(m_vm), m_lexer.get());
</span><del>-    failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode), &quot;Cannot parse body of this function&quot;);
</del><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode, parseType), parseType == StandardFunctionParseType ? &quot;Cannot parse body of this function&quot; : &quot;Cannot parse body of this arrow function&quot;);
+#else
+    failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode, StandardFunctionParseType), &quot;Cannot parse body of this function&quot;);
+#endif
</ins><span class="cx">     unsigned endColumn = tokenColumn();
</span><span class="cx">     return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, functionKeywordStart, functionNameStart, parametersStart, strictMode(), constructorKind);
</span><span class="cx"> }
</span><span class="lines">@@ -1339,27 +1398,46 @@
</span><span class="cx">         return &quot;function&quot;;
</span><span class="cx">     case MethodMode:
</span><span class="cx">         return &quot;method&quot;;
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    case ArrowFunctionMode:
+        return &quot;arrow function&quot;;
+#endif
</ins><span class="cx">     }
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template &lt;typename LexerType&gt; template &lt;class TreeBuilder&gt; int Parser&lt;LexerType&gt;::parseFunctionParameters(TreeBuilder&amp; context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, AutoPopScopeRef&amp; functionScope, ParserFunctionInfo&lt;TreeBuilder&gt;&amp; info)
</del><ins>+template &lt;typename LexerType&gt; template &lt;class TreeBuilder&gt; int Parser&lt;LexerType&gt;::parseFunctionParameters(TreeBuilder&amp; context, FunctionParseMode mode, ParserFunctionInfo&lt;TreeBuilder&gt;&amp; info)
</ins><span class="cx"> {
</span><del>-    if (match(IDENT)) {
-        info.name = m_token.m_data.ident;
-        m_lastFunctionName = info.name;
-        next();
-        if (!nameIsInContainingScope)
-            failIfFalseIfStrict(functionScope-&gt;declareVariable(info.name), &quot;'&quot;, info.name-&gt;impl(), &quot;' is not a valid &quot;, stringForFunctionMode(mode), &quot; name in strict mode&quot;);
-    } else if (requirements == FunctionNeedsName) {
-        if (match(OPENPAREN) &amp;&amp; mode == FunctionMode)
-            semanticFail(&quot;Function statements must have a name&quot;);
-        semanticFailureDueToKeyword(stringForFunctionMode(mode), &quot; name&quot;);
-        failDueToUnexpectedToken();
-        return false;
</del><ins>+    int parametersStart = m_token.m_location.startOffset;
+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    if (mode == ArrowFunctionMode) {
+        if (!match(IDENT) &amp;&amp; !match(OPENPAREN)) {
+            semanticFailureDueToKeyword(stringForFunctionMode(mode), &quot; name&quot;);
+            failWithMessage(&quot;Expected an arrow function input parameter&quot;);
+        } else {
+            if (match(OPENPAREN)) {
+                next();
+                
+                if (!match(CLOSEPAREN)) {
+                    info.parameters = parseFormalParameters(context);
+                    failIfFalse(info.parameters, &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
+                }
+                
+                consumeOrFail(CLOSEPAREN, &quot;Expected a ')' or a ',' after a parameter declaration&quot;);
+            } else {
+                auto parameter = parseDeconstructionPattern(context, DeconstructToParameters);
+                failIfFalse(parameter, &quot;Cannot parse parameter pattern&quot;);
+                info.parameters = context.createFormalParameterList(parameter);
+                failIfFalse(info.parameters, &quot;Cannot parse parameters for this &quot;, stringForFunctionMode(mode));
+            }
+        }
+        
+        return parametersStart;
</ins><span class="cx">     }
</span><del>-    int parametersStart = m_token.m_location.startOffset;
</del><ins>+#endif
+    
</ins><span class="cx">     if (!consume(OPENPAREN)) {
</span><span class="cx">         semanticFailureDueToKeyword(stringForFunctionMode(mode), &quot; name&quot;);
</span><span class="cx">         failWithMessage(&quot;Expected an opening '(' before a &quot;, stringForFunctionMode(mode), &quot;'s parameter list&quot;);
</span><span class="lines">@@ -1384,43 +1462,89 @@
</span><span class="cx">     
</span><span class="cx">     return parametersStart;
</span><span class="cx"> }
</span><del>-    
</del><ins>+
</ins><span class="cx"> template &lt;typename LexerType&gt;
</span><del>-template &lt;class TreeBuilder&gt; bool Parser&lt;LexerType&gt;::parseFunctionInfo(TreeBuilder&amp; context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo&lt;TreeBuilder&gt;&amp; info)
</del><ins>+template &lt;class TreeBuilder&gt; bool Parser&lt;LexerType&gt;::parseFunctionInfo(TreeBuilder&amp; context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo&lt;TreeBuilder&gt;&amp; info, FunctionParseType parseType)
</ins><span class="cx"> {
</span><span class="cx">     AutoPopScopeRef functionScope(this, pushScope());
</span><span class="cx">     functionScope-&gt;setIsFunction();
</span><span class="cx">     int functionNameStart = m_token.m_location.startOffset;
</span><span class="cx">     const Identifier* lastFunctionName = m_lastFunctionName;
</span><span class="cx">     m_lastFunctionName = nullptr;
</span><ins>+    int parametersStart;
</ins><span class="cx">     
</span><del>-    int parametersStart = parseFunctionParameters(context, requirements, mode, nameIsInContainingScope, functionScope, info);
-    propagateError();
</del><ins>+    switch (parseType) {
+    case StandardFunctionParseType: {
+        if (match(IDENT)) {
+            info.name = m_token.m_data.ident;
+            m_lastFunctionName = info.name;
+            next();
+            if (!nameIsInContainingScope)
+                failIfFalseIfStrict(functionScope-&gt;declareVariable(info.name), &quot;'&quot;, info.name-&gt;impl(), &quot;' is not a valid &quot;, stringForFunctionMode(mode), &quot; name in strict mode&quot;);
+        } else if (requirements == FunctionNeedsName) {
+            if (match(OPENPAREN) &amp;&amp; mode == FunctionMode)
+                semanticFail(&quot;Function statements must have a name&quot;);
+            semanticFailureDueToKeyword(stringForFunctionMode(mode), &quot; name&quot;);
+            failDueToUnexpectedToken();
+            return false;
+        }
+        
+        parametersStart = parseFunctionParameters(context, mode, info);
+        propagateError();
+        
+        matchOrFail(OPENBRACE, &quot;Expected an opening '{' at the start of a &quot;, stringForFunctionMode(mode), &quot; body&quot;);
+        
+        // BytecodeGenerator emits code to throw TypeError when a class constructor is &quot;call&quot;ed.
+        // Set ConstructorKind to None for non-constructor methods of classes.
+    
+        if (m_defaultConstructorKind != ConstructorKind::None) {
+            constructorKind = m_defaultConstructorKind;
+            expectedSuperBinding = m_defaultConstructorKind == ConstructorKind::Derived ? SuperBinding::Needed : SuperBinding::NotNeeded;
+        }
+        
+        info.startFunctionOffset = m_token.m_data.offset;
+        
+        break;
+    }
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    case ArrowFunctionParseType: {
+        parametersStart = parseFunctionParameters(context, ArrowFunctionMode, info);
+        propagateError();
+        
+        matchOrFail(ARROWFUNCTION, &quot;Expected a '=&gt;' after arrow function parameter declaration&quot;);
+        ASSERT(constructorKind == ConstructorKind::None);
+        
+        info.arrowFunctionOffset = m_token.m_data.offset;
+        // Check if arrow body start with {. If it true it mean that arrow function is Fat arrow function
+        // and we need use common approach to parse function body
+        SavePoint savePoint = createSavePoint();
+        
+        next();
+        info.functionBodyType = match(OPENBRACE) ? ArrowFunctionBodyBlock : ArrowFunctionBodyExpression;
+        info.startFunctionOffset = (info.functionBodyType == ArrowFunctionBodyBlock) ? m_token.m_data.offset : info.arrowFunctionOffset;
+        
+        restoreSavePoint(savePoint);
</ins><span class="cx"> 
</span><del>-    matchOrFail(OPENBRACE, &quot;Expected an opening '{' at the start of a &quot;, stringForFunctionMode(mode), &quot; body&quot;);
-
-    // BytecodeGenerator emits code to throw TypeError when a class constructor is &quot;call&quot;ed.
-    // Set ConstructorKind to None for non-constructor methods of classes.
-    if (m_defaultConstructorKind != ConstructorKind::None) {
-        constructorKind = m_defaultConstructorKind;
-        expectedSuperBinding = m_defaultConstructorKind == ConstructorKind::Derived ? SuperBinding::Needed : SuperBinding::NotNeeded;
</del><ins>+        break;
</ins><span class="cx">     }
</span><ins>+#endif
+    }
+    
</ins><span class="cx">     bool isClassConstructor = constructorKind != ConstructorKind::None;
</span><span class="cx"> 
</span><del>-    info.openBraceOffset = m_token.m_data.offset;
</del><span class="cx">     info.bodyStartLine = tokenLine();
</span><span class="cx">     info.bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
</span><span class="cx">     JSTokenLocation startLocation(tokenLocation());
</span><span class="cx">     
</span><span class="cx">     // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
</span><del>-    if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(info.openBraceOffset) : 0) {
</del><ins>+    if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(info.startFunctionOffset) : 0) {
</ins><span class="cx">         // If we're in a strict context, the cached function info must say it was strict too.
</span><span class="cx">         ASSERT(!strictMode() || cachedInfo-&gt;strictMode);
</span><span class="cx">         JSTokenLocation endLocation;
</span><span class="cx"> 
</span><del>-        endLocation.line = cachedInfo-&gt;closeBraceLine;
-        endLocation.startOffset = cachedInfo-&gt;closeBraceOffset;
-        endLocation.lineStartOffset = cachedInfo-&gt;closeBraceLineStartOffset;
</del><ins>+        endLocation.line = cachedInfo-&gt;lastTockenLine;
+        endLocation.startOffset = cachedInfo-&gt;lastTockenStartOffset;
+        endLocation.lineStartOffset = cachedInfo-&gt;lastTockenLineStartOffset;
</ins><span class="cx"> 
</span><span class="cx">         bool endColumnIsOnStartLine = (endLocation.line == info.bodyStartLine);
</span><span class="cx">         ASSERT(endLocation.startOffset &gt;= endLocation.lineStartOffset);
</span><span class="lines">@@ -1437,24 +1561,64 @@
</span><span class="cx">         functionScope-&gt;restoreFromSourceProviderCache(cachedInfo);
</span><span class="cx">         failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), &quot;Parser error&quot;);
</span><span class="cx">         
</span><del>-        info.closeBraceOffset = cachedInfo-&gt;closeBraceOffset;
-
-        m_token = cachedInfo-&gt;closeBraceToken();
</del><ins>+        m_token = cachedInfo-&gt;endFunctionToken();
+        
</ins><span class="cx">         if (endColumnIsOnStartLine)
</span><span class="cx">             m_token.m_location.lineStartOffset = currentLineStartOffset;
</span><span class="cx"> 
</span><span class="cx">         m_lexer-&gt;setOffset(m_token.m_location.endOffset, m_token.m_location.lineStartOffset);
</span><span class="cx">         m_lexer-&gt;setLineNumber(m_token.m_location.line);
</span><del>-
</del><ins>+        info.endFunctionOffset = cachedInfo-&gt;endFunctionOffset;
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+        if (parseType == ArrowFunctionParseType)
+            info.functionBodyType = cachedInfo-&gt;isBodyArrowExpression ?  ArrowFunctionBodyExpression : ArrowFunctionBodyBlock;
+        else
+            info.functionBodyType = StandardFunctionBodyBlock;
+        
+        switch (info.functionBodyType) {
+        case ArrowFunctionBodyExpression:
+            next();
+            context.setEndOffset(info.body, m_lexer-&gt;currentOffset());
+            break;
+        case ArrowFunctionBodyBlock:
+        case StandardFunctionBodyBlock:
+            context.setEndOffset(info.body, m_lexer-&gt;currentOffset());
+            next();
+            break;
+        }
+#else
</ins><span class="cx">         context.setEndOffset(info.body, m_lexer-&gt;currentOffset());
</span><del>-        
</del><span class="cx">         next();
</span><ins>+#endif
</ins><span class="cx">         info.bodyEndLine = m_lastTokenEndPosition.line;
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><ins>+    
</ins><span class="cx">     m_lastFunctionName = lastFunctionName;
</span><span class="cx">     ParserState oldState = saveState();
</span><del>-    info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind);
</del><ins>+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    switch (info.functionBodyType) {
+    case ArrowFunctionBodyBlock: {
+        // Consume =&gt; in case of arrow function block e.g. x =&gt; { return x; }
+        next();
+    
+        info.bodyStartLine = tokenLine();
+        info.bodyStartColumn = m_token.m_data.offset - m_token.m_data.lineStartOffset;
+            
+        info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, StandardFunctionParseType);
+        break;
+    }
+    case StandardFunctionBodyBlock:
+    case ArrowFunctionBodyExpression : {
+        info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, parseType);
+        break;
+    }
+    }
+#else
+    info.body = parseFunctionBody(context, functionKeywordStart, functionNameStart, parametersStart, constructorKind, StandardFunctionParseType);
+#endif
+    
</ins><span class="cx">     restoreState(oldState);
</span><span class="cx">     failIfFalse(info.body, &quot;Cannot parse the body of this &quot;, stringForFunctionMode(mode));
</span><span class="cx">     context.setEndOffset(info.body, m_lexer-&gt;currentOffset());
</span><span class="lines">@@ -1470,33 +1634,56 @@
</span><span class="cx">     if (functionScope-&gt;needsSuperBinding())
</span><span class="cx">         semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, &quot;super can only be used in a method of a derived class&quot;);
</span><span class="cx"> 
</span><del>-    info.closeBraceOffset = m_token.m_data.offset;
-    unsigned closeBraceLine = m_token.m_data.line;
-    unsigned closeBraceLineStartOffset = m_token.m_data.lineStartOffset;
</del><ins>+    JSTokenLocation location = JSTokenLocation(m_token.m_location);
+    info.endFunctionOffset = m_token.m_data.offset;
</ins><span class="cx">     
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    if (info.functionBodyType == ArrowFunctionBodyExpression) {
+        location = locationBeforeLastToken();
+        info.endFunctionOffset = location.endOffset;
+    }
+#endif
+    
</ins><span class="cx">     // Cache the tokenizer state and the function scope the first time the function is parsed.
</span><span class="cx">     // Any future reparsing can then skip the function.
</span><span class="cx">     static const int minimumFunctionLengthToCache = 16;
</span><span class="cx">     std::unique_ptr&lt;SourceProviderCacheItem&gt; newInfo;
</span><del>-    int functionLength = info.closeBraceOffset - info.openBraceOffset;
</del><ins>+    int functionLength = info.endFunctionOffset - info.startFunctionOffset;
</ins><span class="cx">     if (TreeBuilder::CanUseFunctionCache &amp;&amp; m_functionCache &amp;&amp; functionLength &gt; minimumFunctionLengthToCache) {
</span><span class="cx">         SourceProviderCacheItemCreationParameters parameters;
</span><ins>+        parameters.endFunctionOffset = info.endFunctionOffset;
</ins><span class="cx">         parameters.functionNameStart = functionNameStart;
</span><del>-        parameters.closeBraceLine = closeBraceLine;
-        parameters.closeBraceOffset = info.closeBraceOffset;
-        parameters.closeBraceLineStartOffset = closeBraceLineStartOffset;
</del><ins>+        parameters.lastTockenLine = location.line;
+        parameters.lastTockenStartOffset = location.startOffset;
+        parameters.lastTockenEndOffset = location.endOffset;
+        parameters.lastTockenLineStartOffset = location.lineStartOffset;
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+        if (info.functionBodyType == ArrowFunctionBodyExpression) {
+            parameters.isBodyArrowExpression = true;
+            parameters.tokenType = m_token.m_type;
+        }
+#endif
</ins><span class="cx">         functionScope-&gt;fillParametersForSourceProviderCache(parameters);
</span><span class="cx">         newInfo = SourceProviderCacheItem::create(parameters);
</span><del>-
</del><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), &quot;Parser error&quot;);
</span><ins>+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    if (info.functionBodyType == ArrowFunctionBodyExpression)
+        failIfFalse(isEndOfArrowFunction(), &quot;Expected the closing ';' ',' ']' ')' '}', line terminator or EOF after arrow function&quot;);
+    else {
+        matchOrFail(CLOSEBRACE, &quot;Expected a closing '}' after a &quot;, stringForFunctionMode(mode), &quot; body&quot;);
+        next();
+    }
+#else
</ins><span class="cx">     matchOrFail(CLOSEBRACE, &quot;Expected a closing '}' after a &quot;, stringForFunctionMode(mode), &quot; body&quot;);
</span><ins>+    next();
+#endif
</ins><span class="cx">     
</span><span class="cx">     if (newInfo)
</span><del>-        m_functionCache-&gt;add(info.openBraceOffset, WTF::move(newInfo));
</del><ins>+        m_functionCache-&gt;add(info.startFunctionOffset, WTF::move(newInfo));
</ins><span class="cx">     
</span><del>-    next();
</del><span class="cx">     info.bodyEndLine = m_lastTokenEndPosition.line;
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -1510,7 +1697,7 @@
</span><span class="cx">     next();
</span><span class="cx">     ParserFunctionInfo&lt;TreeBuilder&gt; info;
</span><span class="cx">     failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded,
</span><del>-        functionKeywordStart, info)), &quot;Cannot parse this function&quot;);
</del><ins>+        functionKeywordStart, info, StandardFunctionParseType)), &quot;Cannot parse this function&quot;);
</ins><span class="cx">     failIfFalse(info.name, &quot;Function statements must have a name&quot;);
</span><span class="cx">     failIfFalseIfStrict(declareVariable(info.name), &quot;Cannot declare a function named '&quot;, info.name-&gt;impl(), &quot;' in strict mode&quot;);
</span><span class="cx">     return context.createFuncDeclStatement(location, info);
</span><span class="lines">@@ -1629,8 +1816,7 @@
</span><span class="cx">         } else {
</span><span class="cx">             ParserFunctionInfo&lt;TreeBuilder&gt; methodInfo;
</span><span class="cx">             bool isConstructor = !isStaticMethod &amp;&amp; *ident == propertyNames.constructor;
</span><del>-            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, isStaticMethod ? FunctionMode : MethodMode, false,
-                isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo)), &quot;Cannot parse this method&quot;);
</del><ins>+            failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, isStaticMethod ? FunctionMode : MethodMode, false, isConstructor ? constructorKind : ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, StandardFunctionParseType)), &quot;Cannot parse this method&quot;);
</ins><span class="cx">             failIfFalse(ident &amp;&amp; declareVariable(ident), &quot;Cannot declare a method named '&quot;, methodInfo.name-&gt;impl(), &quot;'&quot;);
</span><span class="cx">             methodInfo.name = isConstructor ? className : ident;
</span><span class="cx"> 
</span><span class="lines">@@ -1871,6 +2057,7 @@
</span><span class="cx">     return head;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+    
</ins><span class="cx"> template &lt;typename LexerType&gt;
</span><span class="cx"> template &lt;typename TreeBuilder&gt; TreeExpression Parser&lt;LexerType&gt;::parseAssignmentExpression(TreeBuilder&amp; context)
</span><span class="cx"> {
</span><span class="lines">@@ -1889,6 +2076,12 @@
</span><span class="cx">         }
</span><span class="cx">         restoreSavePoint(savePoint);
</span><span class="cx">     }
</span><ins>+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    if (isArrowFunctionParamters())
+        return parseArrowFunctionExpression(context);
+#endif
+    
</ins><span class="cx">     TreeExpression lhs = parseConditionalExpression(context);
</span><span class="cx">     failIfFalse(lhs, &quot;Cannot parse expression&quot;);
</span><span class="cx">     if (initialNonLHSCount != m_nonLHSCount) {
</span><span class="lines">@@ -2129,8 +2322,7 @@
</span><span class="cx">     JSTokenLocation methodLocation(tokenLocation());
</span><span class="cx">     unsigned methodStart = tokenStart();
</span><span class="cx">     ParserFunctionInfo&lt;TreeBuilder&gt; methodInfo;
</span><del>-    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, MethodMode, false, ConstructorKind::None, SuperBinding::NotNeeded,
-        methodStart, methodInfo)), &quot;Cannot parse this method&quot;);
</del><ins>+    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, MethodMode, false, ConstructorKind::None, SuperBinding::NotNeeded, methodStart, methodInfo, StandardFunctionParseType)), &quot;Cannot parse this method&quot;);
</ins><span class="cx">     methodInfo.name = methodName;
</span><span class="cx">     return context.createFunctionExpr(methodLocation, methodInfo);
</span><span class="cx"> }
</span><span class="lines">@@ -2157,11 +2349,11 @@
</span><span class="cx">     if (type &amp; PropertyNode::Getter) {
</span><span class="cx">         failIfFalse(match(OPENPAREN), &quot;Expected a parameter list for getter definition&quot;);
</span><span class="cx">         failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, constructorKind, superBinding,
</span><del>-            getterOrSetterStartOffset, info)), &quot;Cannot parse getter definition&quot;);
</del><ins>+            getterOrSetterStartOffset, info, StandardFunctionParseType)), &quot;Cannot parse getter definition&quot;);
</ins><span class="cx">     } else {
</span><span class="cx">         failIfFalse(match(OPENPAREN), &quot;Expected a parameter list for setter definition&quot;);
</span><span class="cx">         failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, constructorKind, superBinding,
</span><del>-            getterOrSetterStartOffset, info)), &quot;Cannot parse setter definition&quot;);
</del><ins>+            getterOrSetterStartOffset, info, StandardFunctionParseType)), &quot;Cannot parse setter definition&quot;);
</ins><span class="cx">     }
</span><span class="cx">     if (stringPropertyName)
</span><span class="cx">         return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, superBinding);
</span><span class="lines">@@ -2428,8 +2620,7 @@
</span><span class="cx">         next();
</span><span class="cx">         ParserFunctionInfo&lt;TreeBuilder&gt; info;
</span><span class="cx">         info.name = &amp;m_vm-&gt;propertyNames-&gt;nullIdentifier;
</span><del>-        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded,
-            functionKeywordStart, info)), &quot;Cannot parse function expression&quot;);
</del><ins>+        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, StandardFunctionParseType)), &quot;Cannot parse function expression&quot;);
</ins><span class="cx">         return context.createFunctionExpr(location, info);
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(ES6_CLASS_SYNTAX)
</span><span class="lines">@@ -2669,6 +2860,22 @@
</span><span class="cx">     return base;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+template &lt;typename LexerType&gt;
+template &lt;class TreeBuilder&gt; TreeExpression Parser&lt;LexerType&gt;::parseArrowFunctionExpression(TreeBuilder&amp; context)
+{
+    JSTokenLocation location;
+
+    unsigned functionKeywordStart = tokenStart();
+    location = tokenLocation();
+    ParserFunctionInfo&lt;TreeBuilder&gt; info;
+    info.name = &amp;m_vm-&gt;propertyNames-&gt;nullIdentifier;
+    failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, true, ConstructorKind::None, SuperBinding::NotNeeded, functionKeywordStart, info, ArrowFunctionParseType)), &quot;Cannot parse arrow function expression&quot;);
+
+    return context.createArrowFunctionExpr(location, info);
+}
+#endif
+
</ins><span class="cx"> static const char* operatorString(bool prefix, unsigned tok)
</span><span class="cx"> {
</span><span class="cx">     switch (tok) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -80,12 +80,20 @@
</span><span class="cx"> COMPILE_ASSERT(LastUntaggedToken &lt; 64, LessThan64UntaggedTokens);
</span><span class="cx"> 
</span><span class="cx"> enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode };
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+enum FunctionParseType { StandardFunctionParseType, ArrowFunctionParseType };
+#else
+enum FunctionParseType { StandardFunctionParseType};
+#endif
</ins><span class="cx"> enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName };
</span><span class="cx"> enum FunctionParseMode {
</span><span class="cx">     FunctionMode,
</span><span class="cx">     GetterMode,
</span><span class="cx">     SetterMode,
</span><span class="cx">     MethodMode,
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    ArrowFunctionMode
+#endif
</ins><span class="cx"> };
</span><span class="cx"> enum DeconstructionKind {
</span><span class="cx">     DeconstructToVariables,
</span><span class="lines">@@ -430,6 +438,7 @@
</span><span class="cx">     std::unique_ptr&lt;ParsedNode&gt; parse(ParserError&amp;);
</span><span class="cx"> 
</span><span class="cx">     JSTextPosition positionBeforeLastNewline() const { return m_lexer-&gt;positionBeforeLastNewline(); }
</span><ins>+    JSTokenLocation locationBeforeLastToken() const { return m_lexer-&gt;lastTokenLocation(); }
</ins><span class="cx">     Vector&lt;RefPtr&lt;UniquedStringImpl&gt;&gt;&amp;&amp; closedVariables() { return WTF::move(m_closedVariables); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -612,6 +621,47 @@
</span><span class="cx">         return m_token.m_type == IDENT &amp;&amp; *m_token.m_data.ident == m_vm-&gt;propertyNames-&gt;of;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    ALWAYS_INLINE bool isEndOfArrowFunction()
+    {
+        return match(SEMICOLON) || match(COMMA) || match(CLOSEPAREN) || match(CLOSEBRACE) || match(CLOSEBRACKET) || match(EOFTOK) || m_lexer-&gt;prevTerminator();
+    }
+    
+    ALWAYS_INLINE bool isArrowFunctionParamters()
+    {
+        bool isArrowFunction = false;
+        
+        if (match(EOFTOK))
+            return isArrowFunction;
+        
+        SavePoint saveArrowFunctionPoint = createSavePoint();
+        
+        if (consume(OPENPAREN)) {
+            bool isArrowFunctionParamters = true;
+            
+            while (consume(IDENT)) {
+                if (consume(COMMA)) {
+                    if (!match(IDENT)) {
+                        isArrowFunctionParamters = false;
+                        break;
+                    }
+                } else
+                    break;
+            }
+            
+            if (isArrowFunctionParamters) {
+                if (consume(CLOSEPAREN) &amp;&amp; match(ARROWFUNCTION))
+                    isArrowFunction = true;
+            }
+        } else if (consume(IDENT) &amp;&amp; match(ARROWFUNCTION))
+            isArrowFunction = true;
+
+        restoreSavePoint(saveArrowFunctionPoint);
+        
+        return isArrowFunction;
+    }
+#endif
+    
</ins><span class="cx">     ALWAYS_INLINE unsigned tokenStart()
</span><span class="cx">     {
</span><span class="cx">         return m_token.m_location.startOffset;
</span><span class="lines">@@ -715,8 +765,8 @@
</span><span class="cx">         }
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><del>-    
-    template &lt;class TreeBuilder&gt; TreeSourceElements parseSourceElements(TreeBuilder&amp;, SourceElementsMode);
</del><ins>+
+    template &lt;class TreeBuilder&gt; TreeSourceElements parseSourceElements(TreeBuilder&amp;, SourceElementsMode, FunctionParseType);
</ins><span class="cx">     template &lt;class TreeBuilder&gt; TreeStatement parseStatement(TreeBuilder&amp;, const Identifier*&amp; directive, unsigned* directiveLiteralLength = 0);
</span><span class="cx"> #if ENABLE(ES6_CLASS_SYNTAX)
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeStatement parseClassDeclaration(TreeBuilder&amp;);
</span><span class="lines">@@ -756,24 +806,30 @@
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeProperty parseProperty(TreeBuilder&amp;, bool strict);
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeExpression parsePropertyMethod(TreeBuilder&amp; context, const Identifier* methodName);
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeProperty parseGetterSetter(TreeBuilder&amp;, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);
</span><del>-    template &lt;class TreeBuilder&gt; ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&amp;, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind);
</del><ins>+    template &lt;class TreeBuilder&gt; ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&amp;, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionParseType);
</ins><span class="cx">     template &lt;class TreeBuilder&gt; ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&amp;);
</span><span class="cx">     enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
</span><span class="cx">     template &lt;class TreeBuilder&gt; TreeExpression parseVarDeclarationList(TreeBuilder&amp;, int&amp; declarations, TreeDeconstructionPattern&amp; lastPattern, TreeExpression&amp; lastInitializer, JSTextPosition&amp; identStart, JSTextPosition&amp; initStart, JSTextPosition&amp; initEnd, VarDeclarationListContext);
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder&amp;);
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    template &lt;class TreeBuilder&gt; TreeStatement parseArrowFunctionSingleExpressionBody(TreeBuilder&amp;, FunctionParseType);
+    template &lt;class TreeBuilder&gt; TreeExpression parseArrowFunctionExpression(TreeBuilder&amp;);
+#endif
+
</ins><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeDeconstructionPattern createBindingPattern(TreeBuilder&amp;, DeconstructionKind, const Identifier&amp;, int depth, JSToken);
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeDeconstructionPattern parseDeconstructionPattern(TreeBuilder&amp;, DeconstructionKind, int depth = 0);
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeDeconstructionPattern tryParseDeconstructionPatternExpression(TreeBuilder&amp;);
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeExpression parseDefaultValueForDeconstructionPattern(TreeBuilder&amp;);
</span><span class="cx"> 
</span><del>-    template &lt;class TreeBuilder&gt; NEVER_INLINE bool parseFunctionInfo(TreeBuilder&amp;, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo&lt;TreeBuilder&gt;&amp;);
</del><ins>+    template &lt;class TreeBuilder&gt; NEVER_INLINE bool parseFunctionInfo(TreeBuilder&amp;, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo&lt;TreeBuilder&gt;&amp;, FunctionParseType);
</ins><span class="cx">     
</span><del>-    template &lt;class TreeBuilder&gt; NEVER_INLINE int parseFunctionParameters(TreeBuilder&amp;, FunctionRequirements, FunctionParseMode, bool, AutoPopScopeRef&amp;, ParserFunctionInfo&lt;TreeBuilder&gt;&amp;);
</del><ins>+    template &lt;class TreeBuilder&gt; NEVER_INLINE int parseFunctionParameters(TreeBuilder&amp;, FunctionParseMode, ParserFunctionInfo&lt;TreeBuilder&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(ES6_CLASS_SYNTAX)
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE TreeClassExpression parseClass(TreeBuilder&amp;, FunctionRequirements, ParserClassInfo&lt;TreeBuilder&gt;&amp;);
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> #if ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX)
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE typename TreeBuilder::TemplateString parseTemplateString(TreeBuilder&amp; context, bool isTemplateHead, typename LexerType::RawStringsBuildMode, bool&amp; elementIsTail);
</span><span class="cx">     template &lt;class TreeBuilder&gt; NEVER_INLINE typename TreeBuilder::TemplateLiteral parseTemplateLiteral(TreeBuilder&amp;, typename LexerType::RawStringsBuildMode);
</span><span class="lines">@@ -793,6 +849,14 @@
</span><span class="cx">         return allowAutomaticSemicolon();
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    void setEndOfStatement()
+    {
+        m_lexer-&gt;setTokenPosition(&amp;m_token);
+    }
+#endif
+
</ins><span class="cx">     bool canRecurse()
</span><span class="cx">     {
</span><span class="cx">         return m_vm-&gt;isSafeToRecurse();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserFunctionInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/ParserFunctionInfo.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -28,16 +28,27 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+enum FunctionBodyType { ArrowFunctionBodyExpression, ArrowFunctionBodyBlock, StandardFunctionBodyBlock };
+#endif
+
</ins><span class="cx"> template &lt;class TreeBuilder&gt;
</span><span class="cx"> struct ParserFunctionInfo {
</span><span class="cx">     const Identifier* name = 0;
</span><span class="cx">     typename TreeBuilder::FormalParameterList parameters = 0;
</span><span class="cx">     typename TreeBuilder::FunctionBody body = 0;
</span><del>-    unsigned openBraceOffset = 0;
-    unsigned closeBraceOffset = 0;
</del><ins>+    unsigned startFunctionOffset = 0;
+    unsigned endFunctionOffset = 0;
</ins><span class="cx">     int bodyStartLine = 0;
</span><span class="cx">     int bodyEndLine = 0;
</span><span class="cx">     unsigned bodyStartColumn = 0;
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    unsigned arrowFunctionOffset = 0;
+    unsigned arrowFunctionNextTockenEndOffset = 0;
+    bool isArrowFunction { false };
+    bool isEndByTerminator { false };
+    FunctionBodyType functionBodyType { StandardFunctionBodyBlock };
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ES6_CLASS_SYNTAX)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserTokensh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ParserTokens.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ParserTokens.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/ParserTokens.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -75,6 +75,9 @@
</span><span class="cx">     FINALLY,
</span><span class="cx">     DEBUGGER,
</span><span class="cx">     ELSE,
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    ARROWFUNCTION,
+#endif
</ins><span class="cx"> #if ENABLE(ES6_CLASS_SYNTAX)
</span><span class="cx">     CLASSTOKEN,
</span><span class="cx">     EXTENDS,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSourceCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SourceCode.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SourceCode.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/SourceCode.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -105,6 +105,9 @@
</span><span class="cx">         
</span><span class="cx">         SourceCode subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn);
</span><span class="cx"> 
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+        SourceCode subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn);
+#endif
</ins><span class="cx">     private:
</span><span class="cx">         RefPtr&lt;SourceProvider&gt; m_provider;
</span><span class="cx">         int m_startChar;
</span><span class="lines">@@ -117,7 +120,17 @@
</span><span class="cx">     {
</span><span class="cx">         return SourceCode(StringSourceProvider::create(source, url, startPosition), startPosition.m_line.oneBasedInt(), startPosition.m_column.oneBasedInt());
</span><span class="cx">     }
</span><ins>+    
+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    inline SourceCode SourceCode::subArrowExpression(unsigned startArrowFunction, unsigned endArrowFunction, int firstLine, int startColumn)
+    {
+        ASSERT(provider()-&gt;source()[startArrowFunction] == '=' &amp;&amp; provider()-&gt;source()[startArrowFunction + 1] == '&gt;');
</ins><span class="cx"> 
</span><ins>+        startColumn += 1; // Convert to base 1.
+        return SourceCode(provider(), startArrowFunction, endArrowFunction, firstLine, startColumn);
+    }
+#endif
+
</ins><span class="cx">     inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine, int startColumn)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(provider()-&gt;source()[openBrace] == '{');
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSourceProviderCacheItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -35,14 +35,20 @@
</span><span class="cx"> 
</span><span class="cx"> struct SourceProviderCacheItemCreationParameters {
</span><span class="cx">     unsigned functionNameStart;
</span><del>-    unsigned closeBraceLine;
-    unsigned closeBraceOffset;
-    unsigned closeBraceLineStartOffset;
</del><ins>+    unsigned lastTockenLine;
+    unsigned lastTockenStartOffset;
+    unsigned lastTockenEndOffset;
+    unsigned lastTockenLineStartOffset;
+    unsigned endFunctionOffset;
</ins><span class="cx">     bool needsFullActivation;
</span><span class="cx">     bool usesEval;
</span><span class="cx">     bool strictMode;
</span><span class="cx">     Vector&lt;RefPtr&lt;UniquedStringImpl&gt;&gt; usedVariables;
</span><span class="cx">     Vector&lt;RefPtr&lt;UniquedStringImpl&gt;&gt; writtenVariables;
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    bool isBodyArrowExpression { false };
+    JSTokenType tokenType { CLOSEBRACE };
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if COMPILER(MSVC)
</span><span class="lines">@@ -56,15 +62,19 @@
</span><span class="cx">     static std::unique_ptr&lt;SourceProviderCacheItem&gt; create(const SourceProviderCacheItemCreationParameters&amp;);
</span><span class="cx">     ~SourceProviderCacheItem();
</span><span class="cx"> 
</span><del>-    JSToken closeBraceToken() const 
</del><ins>+    JSToken endFunctionToken() const 
</ins><span class="cx">     {
</span><span class="cx">         JSToken token;
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+        token.m_type = isBodyArrowExpression ? tokenType : CLOSEBRACE;
+#else
</ins><span class="cx">         token.m_type = CLOSEBRACE;
</span><del>-        token.m_data.offset = closeBraceOffset;
-        token.m_location.startOffset = closeBraceOffset;
-        token.m_location.endOffset = closeBraceOffset + 1;
-        token.m_location.line = closeBraceLine;
-        token.m_location.lineStartOffset = closeBraceLineStartOffset;
</del><ins>+#endif
+        token.m_data.offset = lastTockenStartOffset;
+        token.m_location.startOffset = lastTockenStartOffset;
+        token.m_location.endOffset = lastTockenEndOffset;
+        token.m_location.line = lastTockenLine;
+        token.m_location.lineStartOffset = lastTockenLineStartOffset;
</ins><span class="cx">         // token.m_location.sourceOffset is initialized once by the client. So,
</span><span class="cx">         // we do not need to set it here.
</span><span class="cx">         return token;
</span><span class="lines">@@ -72,19 +82,26 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned functionNameStart : 31;
</span><span class="cx">     bool needsFullActivation : 1;
</span><ins>+
+    unsigned endFunctionOffset : 31;
+    unsigned lastTockenLine : 31;
+    unsigned lastTockenStartOffset : 31;
+    unsigned lastTockenEndOffset: 31;
</ins><span class="cx">     
</span><del>-    unsigned closeBraceLine : 31;
</del><span class="cx">     bool usesEval : 1;
</span><span class="cx"> 
</span><del>-    unsigned closeBraceOffset : 31;
</del><span class="cx">     bool strictMode : 1;
</span><span class="cx"> 
</span><del>-    unsigned closeBraceLineStartOffset;
</del><ins>+    unsigned lastTockenLineStartOffset;
</ins><span class="cx">     unsigned usedVariablesCount;
</span><span class="cx">     unsigned writtenVariablesCount;
</span><span class="cx"> 
</span><span class="cx">     UniquedStringImpl** usedVariables() const { return const_cast&lt;UniquedStringImpl**&gt;(m_variables); }
</span><span class="cx">     UniquedStringImpl** writtenVariables() const { return const_cast&lt;UniquedStringImpl**&gt;(&amp;m_variables[usedVariablesCount]); }
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    bool isBodyArrowExpression;
+    JSTokenType tokenType;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     SourceProviderCacheItem(const SourceProviderCacheItemCreationParameters&amp;);
</span><span class="lines">@@ -109,13 +126,19 @@
</span><span class="cx"> inline SourceProviderCacheItem::SourceProviderCacheItem(const SourceProviderCacheItemCreationParameters&amp; parameters)
</span><span class="cx">     : functionNameStart(parameters.functionNameStart)
</span><span class="cx">     , needsFullActivation(parameters.needsFullActivation)
</span><del>-    , closeBraceLine(parameters.closeBraceLine)
</del><ins>+    , endFunctionOffset(parameters.endFunctionOffset)
+    , lastTockenLine(parameters.lastTockenLine)
+    , lastTockenStartOffset(parameters.lastTockenStartOffset)
+    , lastTockenEndOffset(parameters.lastTockenEndOffset)
</ins><span class="cx">     , usesEval(parameters.usesEval)
</span><del>-    , closeBraceOffset(parameters.closeBraceOffset)
</del><span class="cx">     , strictMode(parameters.strictMode)
</span><del>-    , closeBraceLineStartOffset(parameters.closeBraceLineStartOffset)
</del><ins>+    , lastTockenLineStartOffset(parameters.lastTockenLineStartOffset)
</ins><span class="cx">     , usedVariablesCount(parameters.usedVariables.size())
</span><span class="cx">     , writtenVariablesCount(parameters.writtenVariables.size())
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    , isBodyArrowExpression(parameters.isBodyArrowExpression)
+    , tokenType(parameters.tokenType)
+#endif
</ins><span class="cx"> {
</span><span class="cx">     unsigned j = 0;
</span><span class="cx">     for (unsigned i = 0; i &lt; usedVariablesCount; ++i, ++j) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSyntaxCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SyntaxChecker.h (185988 => 185989)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2015-06-26 06:42:39 UTC (rev 185988)
+++ trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2015-06-26 06:49:20 UTC (rev 185989)
</span><span class="lines">@@ -179,6 +179,10 @@
</span><span class="cx"> #endif
</span><span class="cx">     ExpressionType createFunctionExpr(const JSTokenLocation&amp;, const ParserFunctionInfo&lt;SyntaxChecker&gt;&amp;) { return FunctionExpr; }
</span><span class="cx">     int createFunctionBody(const JSTokenLocation&amp;, const JSTokenLocation&amp;, int, int, bool, int, int, int, ConstructorKind) { return FunctionBodyResult; }
</span><ins>+#if ENABLE(ES6_ARROWFUNCTION_SYNTAX)
+    ExpressionType createArrowFunctionExpr(const JSTokenLocation&amp;, const ParserFunctionInfo&lt;SyntaxChecker&gt;&amp;) { return FunctionExpr; }
+#endif 
+    void setFunctionNameStart(int, int) { }
</ins><span class="cx">     int createArguments() { return ArgumentsResult; }
</span><span class="cx">     int createArguments(int) { return ArgumentsResult; }
</span><span class="cx">     ExpressionType createSpreadExpression(const JSTokenLocation&amp;, ExpressionType, int, int, int) { return SpreadExpr; }
</span></span></pre>
</div>
</div>

</body>
</html>