<!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>[196261] 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/196261">196261</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-08 11:29:24 -0800 (Mon, 08 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Arrow function syntax. Using 'super' in arrow function that declared out of the class should lead to Syntax error
https://bugs.webkit.org/show_bug.cgi?id=150893

Patch by Skachkov Oleksandr &lt;gskachkov@gmail.com&gt; on 2016-02-08
Reviewed by Saam Barati.
Source/JavaScriptCore:

'super' and 'super()' inside of the arrow function should lead to syntax error if they are used
out of the class context or they wrapped by ordinary function. Now JSC returns ReferenceError but
should return SyntaxError according to the following specs:
http://www.ecma-international.org/ecma-262/6.0/#sec-function-definitions-static-semantics-early-errors
and http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions-runtime-semantics-evaluation
Curren patch implemented only one case when super/super() are used inside of the arrow function
Case when super/super() are used within the eval:
   class A {}
   class B extends A {
       costructor() { eval(&quot;super()&quot;);}
   }
is not part of this patch and will be implemented in this issue https://bugs.webkit.org/show_bug.cgi?id=153864.
The same for case when eval with super/super() is invoked in arrow function will be
implemented in issue https://bugs.webkit.org/show_bug.cgi?id=153977.

* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setExpectedSuperBinding):
(JSC::Scope::expectedSuperBinding):
(JSC::Scope::setConstructorKind):
(JSC::Scope::constructorKind):
(JSC::Parser::closestParentNonArrowFunctionNonLexicalScope):
* tests/stress/arrowfunction-lexical-bind-supercall-4.js:
* tests/stress/arrowfunction-lexical-bind-superproperty.js:

LayoutTests:

Adding tests for using of the 'super' inside of the arrow function

* js/arrowfunction-superproperty-expected.txt:
* js/arrowfunction-syntax-errors-expected.txt:
* js/script-tests/arrowfunction-superproperty.js:
* js/script-tests/arrowfunction-syntax-errors.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsuperpropertyexpectedtxt">trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt">trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsuperpropertyjs">trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs">trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsupercall4js">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-supercall-4.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsuperpropertyjs">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/LayoutTests/ChangeLog        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-02-08  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Using 'super' in arrow function that declared out of the class should lead to Syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=150893
+
+        Reviewed by Saam Barati.
+       
+        Adding tests for using of the 'super' inside of the arrow function

+        * js/arrowfunction-superproperty-expected.txt:
+        * js/arrowfunction-syntax-errors-expected.txt:
+        * js/script-tests/arrowfunction-superproperty.js:
+        * js/script-tests/arrowfunction-syntax-errors.js:
+
</ins><span class="cx"> 2016-02-08  Adrien Plazas  &lt;aplazas@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Timeouts in tests because of non implemented UIScriptController::singleTapAtPoint()
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsuperpropertyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> PASS f.prop is expectedValue + &quot;-&quot; + expectedValue
</span><span class="cx"> PASS f.prop is expectedValue + &quot;-&quot; + &quot;new-value&quot;
</span><span class="cx"> PASS (new F()).getParentValue() is expectedValue
</span><del>-PASS (new F()).getParentValueWithError()() threw exception TypeError: undefined is not an object (evaluating 'super.getValue').
</del><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -131,6 +131,19 @@
</span><span class="cx"> PASS var arr2 = {a, b} =&gt; a + b; threw exception SyntaxError: Unexpected token '=&gt;'. Expected ';' after variable declaration..
</span><span class="cx"> PASS var arr3 = {c:a,d:b} =&gt; a + b; threw exception SyntaxError: Unexpected token '=&gt;'. Expected ';' after variable declaration..
</span><span class="cx"> PASS var arr3 = {c:b,d:a} =&gt; a + b; threw exception SyntaxError: Unexpected token '=&gt;'. Expected ';' after variable declaration..
</span><ins>+PASS var arr4 = () =&gt; { super(); }; threw exception SyntaxError: Cannot call super() outside of a class constructor..
+PASS var arr4 = () =&gt; { super; }; threw exception SyntaxError: Cannot reference super..
+PASS var arr5 = () =&gt; { super.getValue(); }; threw exception SyntaxError: super can only be used in a method of a derived class..
+PASS var arr6 = () =&gt;  super(); threw exception SyntaxError: Cannot call super() outside of a class constructor..
+PASS var arr7 = () =&gt;  super; threw exception SyntaxError: Cannot reference super..
+PASS var arr8 = () =&gt;  super.getValue(); threw exception SyntaxError: super can only be used in a method of a derived class..
+PASS class A { constructor() { function a () { return () =&gt; { super(); };}} threw exception SyntaxError: Cannot call super() outside of a class constructor..
+PASS class B { constructor() { function b () { return () =&gt; { super; }; }; }} threw exception SyntaxError: Cannot reference super..
+PASS class C { constructor() { function c () { return () =&gt; { super.getValue(); };}} threw exception SyntaxError: super can only be used in a method of a derived class..
+PASS class D { constructor() { function a () { return () =&gt; super(); }} threw exception SyntaxError: Cannot call super() outside of a class constructor..
+PASS class E { constructor() { function b () { return () =&gt; super; }; }} threw exception SyntaxError: Cannot reference super..
+PASS class F { constructor() { function c () { return () =&gt; super.getValue(); }} threw exception SyntaxError: super can only be used in a method of a derived class..
+PASS class G {}; class G2 extends G { getValue() { function c () { return () =&gt; super.getValue(); }} threw exception SyntaxError: super can only be used in a method of a derived class..
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsuperpropertyjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -63,12 +63,6 @@
</span><span class="cx">         let arrow = () =&gt; () =&gt; super.getValue();
</span><span class="cx">         return arrow()();
</span><span class="cx">     }
</span><del>-    getParentValueWithError() {
-        var f =  function () {
-            return () =&gt; super.getValue();
-        };
-        return f();
-    }
</del><span class="cx">  };
</span><span class="cx"> 
</span><span class="cx"> shouldBe('(new B()).getValueParentFunction()', 'expectedValue');
</span><span class="lines">@@ -90,6 +84,4 @@
</span><span class="cx"> 
</span><span class="cx"> shouldBe('(new F()).getParentValue()', 'expectedValue');
</span><span class="cx"> 
</span><del>-shouldThrow('(new F()).getParentValueWithError()()');
-
</del><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -48,4 +48,21 @@
</span><span class="cx"> shouldThrow('var arr3 = {c:a,d:b} =&gt; a + b;');
</span><span class="cx"> shouldThrow('var arr3 = {c:b,d:a} =&gt; a + b;');
</span><span class="cx"> 
</span><ins>+shouldThrow('var arr4 = () =&gt; { super(); };', '&quot;SyntaxError: Cannot call super() outside of a class constructor.&quot;');
+shouldThrow('var arr4 = () =&gt; { super; };', '&quot;SyntaxError: Cannot reference super.&quot;');
+shouldThrow('var arr5 = () =&gt; { super.getValue(); };', '&quot;SyntaxError: super can only be used in a method of a derived class.&quot;');
+
+shouldThrow('var arr6 = () =&gt;  super();', '&quot;SyntaxError: Cannot call super() outside of a class constructor.&quot;');
+shouldThrow('var arr7 = () =&gt;  super;', '&quot;SyntaxError: Cannot reference super.&quot;');
+shouldThrow('var arr8 = () =&gt;  super.getValue();', '&quot;SyntaxError: super can only be used in a method of a derived class.&quot;');
+
+shouldThrow('class A { constructor() { function a () { return () =&gt; { super(); };}}', '&quot;SyntaxError: Cannot call super() outside of a class constructor.&quot;');
+shouldThrow('class B { constructor() { function b () { return () =&gt; { super; }; }; }}', '&quot;SyntaxError: Cannot reference super.&quot;');
+shouldThrow('class C { constructor() { function c () { return () =&gt; { super.getValue(); };}}', '&quot;SyntaxError: super can only be used in a method of a derived class.&quot;');
+
+shouldThrow('class D { constructor() { function a () { return () =&gt; super(); }}', '&quot;SyntaxError: Cannot call super() outside of a class constructor.&quot;');
+shouldThrow('class E { constructor() { function b () { return () =&gt; super; }; }}', '&quot;SyntaxError: Cannot reference super.&quot;');
+shouldThrow('class F { constructor() { function c () { return () =&gt; super.getValue(); }}', '&quot;SyntaxError: super can only be used in a method of a derived class.&quot;');
+shouldThrow('class G {}; class G2 extends G { getValue() { function c () { return () =&gt; super.getValue(); }}', '&quot;SyntaxError: super can only be used in a method of a derived class.&quot;');
+
</ins><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-02-08  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Using 'super' in arrow function that declared out of the class should lead to Syntax error
+        https://bugs.webkit.org/show_bug.cgi?id=150893
+
+        Reviewed by Saam Barati.
+
+        'super' and 'super()' inside of the arrow function should lead to syntax error if they are used 
+        out of the class context or they wrapped by ordinary function. Now JSC returns ReferenceError but 
+        should return SyntaxError according to the following specs:
+        http://www.ecma-international.org/ecma-262/6.0/#sec-function-definitions-static-semantics-early-errors
+        and http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions-runtime-semantics-evaluation 
+        Curren patch implemented only one case when super/super() are used inside of the arrow function
+        Case when super/super() are used within the eval:
+           class A {} 
+           class B extends A { 
+               costructor() { eval(&quot;super()&quot;);} 
+           }
+        is not part of this patch and will be implemented in this issue https://bugs.webkit.org/show_bug.cgi?id=153864. 
+        The same for case when eval with super/super() is invoked in arrow function will be 
+        implemented in issue https://bugs.webkit.org/show_bug.cgi?id=153977. 

+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::parseFunctionInfo):
+        * parser/Parser.h:
+        (JSC::Scope::Scope):
+        (JSC::Scope::setExpectedSuperBinding):
+        (JSC::Scope::expectedSuperBinding):
+        (JSC::Scope::setConstructorKind):
+        (JSC::Scope::constructorKind):
+        (JSC::Parser::closestParentNonArrowFunctionNonLexicalScope):
+        * tests/stress/arrowfunction-lexical-bind-supercall-4.js:
+        * tests/stress/arrowfunction-lexical-bind-superproperty.js:
+
</ins><span class="cx"> 2016-02-08  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Parser should detect error before calls to parseAssignmentExpression()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -1976,8 +1976,9 @@
</span><span class="cx">         functionBodyType = StandardFunctionBodyBlock;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool isClassConstructor = constructorKind != ConstructorKind::None;
-    
</del><ins>+    functionScope-&gt;setConstructorKind(constructorKind);
+    functionScope-&gt;setExpectedSuperBinding(expectedSuperBinding);
+
</ins><span class="cx">     functionInfo.bodyStartColumn = startColumn;
</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><span class="lines">@@ -2066,12 +2067,24 @@
</span><span class="cx">         semanticFailIfTrue(m_vm-&gt;propertyNames-&gt;arguments == *functionInfo.name, &quot;'&quot;, functionInfo.name-&gt;impl(), &quot;' is not a valid function name in strict mode&quot;);
</span><span class="cx">         semanticFailIfTrue(m_vm-&gt;propertyNames-&gt;eval == *functionInfo.name, &quot;'&quot;, functionInfo.name-&gt;impl(), &quot;' is not a valid function name in strict mode&quot;);
</span><span class="cx">     }
</span><del>-    if (functionScope-&gt;hasDirectSuper() &amp;&amp; functionBodyType == StandardFunctionBodyBlock) {
-        semanticFailIfTrue(!isClassConstructor, &quot;Cannot call super() outside of a class constructor&quot;);
-        semanticFailIfTrue(constructorKind != ConstructorKind::Derived, &quot;Cannot call super() in a base class constructor&quot;);
</del><ins>+    // It unncecessary to check of using super during reparsing one more time. Also it can lead to syntax error
+    // in case of arrow function becuase during reparsing we don't know that parse arrow function
+    // inside of the constructor or method
+    if (!m_lexer-&gt;isReparsingFunction()) {
+        if (functionScope-&gt;hasDirectSuper()) {
+            ConstructorKind functionConstructorKind = functionBodyType == StandardFunctionBodyBlock
+                ? constructorKind
+                : closestParentNonArrowFunctionNonLexicalScope()-&gt;constructorKind();
+            semanticFailIfTrue(functionConstructorKind == ConstructorKind::None, &quot;Cannot call super() outside of a class constructor&quot;);
+            semanticFailIfTrue(functionConstructorKind != ConstructorKind::Derived, &quot;Cannot call super() in a base class constructor&quot;);
+        }
+        if (functionScope-&gt;needsSuperBinding()) {
+            SuperBinding functionSuperBinding = functionBodyType == StandardFunctionBodyBlock
+                ? expectedSuperBinding
+                : closestParentNonArrowFunctionNonLexicalScope()-&gt;expectedSuperBinding();
+            semanticFailIfTrue(functionSuperBinding == SuperBinding::NotNeeded, &quot;super can only be used in a method of a derived class&quot;);
+        }
</ins><span class="cx">     }
</span><del>-    if (functionScope-&gt;needsSuperBinding() &amp;&amp; functionBodyType == StandardFunctionBodyBlock)
-        semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, &quot;super can only be used in a method of a derived class&quot;);
</del><span class="cx"> 
</span><span class="cx">     JSTokenLocation location = JSTokenLocation(m_token.m_location);
</span><span class="cx">     functionInfo.endOffset = m_token.m_data.offset;
</span><span class="lines">@@ -2083,7 +2096,9 @@
</span><span class="cx">     
</span><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><del>-    static const int minimumFunctionLengthToCache = 16;
</del><ins>+    // For arrow function is 8 = x=&gt;x + 4 symbols;
+    // For ordinary function is 16  = function(){} + 4 symbols
+    const int minimumFunctionLengthToCache = functionBodyType == StandardFunctionBodyBlock ? 16 : 8;
</ins><span class="cx">     std::unique_ptr&lt;SourceProviderCacheItem&gt; newInfo;
</span><span class="cx">     int functionLength = functionInfo.endOffset - functionInfo.startOffset;
</span><span class="cx">     if (TreeBuilder::CanUseFunctionCache &amp;&amp; m_functionCache &amp;&amp; functionLength &gt; minimumFunctionLengthToCache) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -175,6 +175,8 @@
</span><span class="cx">         , m_isFunctionBoundary(false)
</span><span class="cx">         , m_isValidStrictMode(true)
</span><span class="cx">         , m_hasArguments(false)
</span><ins>+        , m_constructorKind(static_cast&lt;unsigned&gt;(ConstructorKind::None))
+        , m_expectedSuperBinding(static_cast&lt;unsigned&gt;(SuperBinding::NotNeeded))
</ins><span class="cx">         , m_loopDepth(0)
</span><span class="cx">         , m_switchDepth(0)
</span><span class="cx">     {
</span><span class="lines">@@ -197,6 +199,8 @@
</span><span class="cx">         , m_isFunctionBoundary(rhs.m_isFunctionBoundary)
</span><span class="cx">         , m_isValidStrictMode(rhs.m_isValidStrictMode)
</span><span class="cx">         , m_hasArguments(rhs.m_hasArguments)
</span><ins>+        , m_constructorKind(rhs.m_constructorKind)
+        , m_expectedSuperBinding(rhs.m_expectedSuperBinding)
</ins><span class="cx">         , m_loopDepth(rhs.m_loopDepth)
</span><span class="cx">         , m_switchDepth(rhs.m_switchDepth)
</span><span class="cx">         , m_moduleScopeData(rhs.m_moduleScopeData)
</span><span class="lines">@@ -458,6 +462,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool needsSuperBinding() { return m_needsSuperBinding; }
</span><span class="cx">     void setNeedsSuperBinding() { m_needsSuperBinding = true; }
</span><ins>+    
+    void setExpectedSuperBinding(SuperBinding superBinding) { m_expectedSuperBinding = static_cast&lt;unsigned&gt;(superBinding); }
+    SuperBinding expectedSuperBinding() const { return static_cast&lt;SuperBinding&gt;(m_expectedSuperBinding); }
+    void setConstructorKind(ConstructorKind constructorKind) { m_constructorKind = static_cast&lt;unsigned&gt;(constructorKind); }
+    ConstructorKind constructorKind() const { return static_cast&lt;ConstructorKind&gt;(m_constructorKind); }
</ins><span class="cx"> 
</span><span class="cx">     void collectFreeVariables(Scope* nestedScope, bool shouldTrackClosedVariables)
</span><span class="cx">     {
</span><span class="lines">@@ -614,6 +623,8 @@
</span><span class="cx">     bool m_isFunctionBoundary : 1;
</span><span class="cx">     bool m_isValidStrictMode : 1;
</span><span class="cx">     bool m_hasArguments : 1;
</span><ins>+    unsigned m_constructorKind : 2;
+    unsigned m_expectedSuperBinding : 2;
</ins><span class="cx">     int m_loopDepth;
</span><span class="cx">     int m_switchDepth;
</span><span class="cx"> 
</span><span class="lines">@@ -866,6 +877,15 @@
</span><span class="cx">         return ScopeRef(&amp;m_scopeStack, i);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    ScopeRef closestParentNonArrowFunctionNonLexicalScope()
+    {
+        unsigned i = m_scopeStack.size() - 1;
+        ASSERT(i &lt; m_scopeStack.size() &amp;&amp; m_scopeStack.size());
+        while (i &amp;&amp; (!m_scopeStack[i].isFunctionBoundary() || m_scopeStack[i].isArrowFunction()))
+            i--;
+        // When reaching the top level scope (it can be non function scope), we return it.
+        return ScopeRef(&amp;m_scopeStack, i);
+    }
</ins><span class="cx">     
</span><span class="cx">     ScopeRef pushScope()
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsupercall4js"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-supercall-4.js (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-supercall-4.js        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-supercall-4.js        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -51,6 +51,9 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+// FIXME: Arrow function does not support using of eval with super/super()
+// https://bugs.webkit.org/show_bug.cgi?id=153977
+/*
</ins><span class="cx"> for (var i=0; i &lt; 1000; i++) {
</span><span class="cx">     new B(true);
</span><span class="cx">     var c = new C();
</span><span class="lines">@@ -60,6 +63,7 @@
</span><span class="cx">     var e = new E();
</span><span class="cx">     testCase(e.id, 'new-value', 'Error during set value in eval #3');
</span><span class="cx"> }
</span><ins>+*/
</ins><span class="cx"> 
</span><span class="cx"> var testException = function (value, index) {
</span><span class="cx">     var exception;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsuperpropertyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js (196260 => 196261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js        2016-02-08 19:27:01 UTC (rev 196260)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js        2016-02-08 19:29:24 UTC (rev 196261)
</span><span class="lines">@@ -123,12 +123,6 @@
</span><span class="cx">      getParentValue() {
</span><span class="cx">          return super.getValue();
</span><span class="cx">      }
</span><del>-     getParentValueWithError() {
-         var f =  function () {
-             return () =&gt; super.getValue();
-         };
-         return f();
-     }
</del><span class="cx">  };
</span><span class="cx"> 
</span><span class="cx">  var g = new G();
</span><span class="lines">@@ -149,20 +143,6 @@
</span><span class="cx">     testCase(getValue(), 'new-value', 'Error: Some problem with using arrow and &quot;super&quot; inside of the method that retun arrow function');
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-var g2 = new G();
-for (var i = 0; i &lt; 10000; i++) {
-    let error = false;
-    try {
-       g2.getParentValueWithError()();
-    } catch(e) {
-      // FIXME: should by check if e instanceof SyntaxError
-      // https://bugs.webkit.org/show_bug.cgi?id=150893
-      error = true;
-    }
-    testCase(error, true, 'Error: using &quot;super&quot; should lead to error');
-}
-
-
</del><span class="cx"> var H = class H extends A {
</span><span class="cx">     constructor() {
</span><span class="cx">         var arrow = () =&gt; () =&gt; super.getValue();
</span></span></pre>
</div>
</div>

</body>
</html>