<!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>[199927] 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/199927">199927</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-04-22 16:04:55 -0700 (Fri, 22 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>super should be available in object literals
https://bugs.webkit.org/show_bug.cgi?id=156933
Reviewed by Saam Barati.
Source/JavaScriptCore:
When we originally implemented classes, super seemed to be a class-only
feature. But the final spec says it's available in object literals too.
* bytecompiler/NodesCodegen.cpp:
(JSC::PropertyListNode::emitBytecode): Having 'super' and being a class
property are no longer synonymous, so we track two separate variables.
(JSC::PropertyListNode::emitPutConstantProperty): Being inside the super
branch no longer guarantees that you're a class property, so we decide
our attributes and our function name dynamically.
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createArrowFunctionExpr):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createArguments):
(JSC::ASTBuilder::createArgumentsList):
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::createPropertyList): Pass through state to indicate
whether we're a class property, since we can't infer it from 'super'
anymore.
* parser/NodeConstructors.h:
(JSC::PropertyNode::PropertyNode): See ASTBuilder.h.
* parser/Nodes.h:
(JSC::PropertyNode::expressionName):
(JSC::PropertyNode::name):
(JSC::PropertyNode::type):
(JSC::PropertyNode::needsSuperBinding):
(JSC::PropertyNode::isClassProperty):
(JSC::PropertyNode::putType): See ASTBuilder.h.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePropertyMethod):
(JSC::Parser<LexerType>::parseGetterSetter):
(JSC::Parser<LexerType>::parseMemberExpression): I made these error
messages generic because it is no longer practical to say concise things
about the list of places you can use super.
* parser/Parser.h:
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createArgumentsList):
(JSC::SyntaxChecker::createProperty):
(JSC::SyntaxChecker::appendExportSpecifier):
(JSC::SyntaxChecker::appendConstDecl):
(JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for
interface change.
* tests/stress/generator-with-super.js:
(test):
* tests/stress/modules-syntax-error.js:
* tests/stress/super-in-lexical-scope.js:
(testSyntaxError):
(testSyntaxError.test):
* tests/stress/tagged-templates-syntax.js: Updated for error message
changes. See Parser.cpp.
LayoutTests:
Updated expected results and added a few new tests.
* js/arrowfunction-syntax-errors-expected.txt:
* js/class-syntax-super-expected.txt:
* js/object-literal-methods-expected.txt:
* js/script-tests/arrowfunction-syntax-errors.js:
* js/script-tests/class-syntax-super.js:
* js/script-tests/object-literal-methods.js:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt">trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsclasssyntaxsuperexpectedtxt">trunk/LayoutTests/js/class-syntax-super-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsobjectliteralmethodsexpectedtxt">trunk/LayoutTests/js/object-literal-methods-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs">trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsclasssyntaxsuperjs">trunk/LayoutTests/js/script-tests/class-syntax-super.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsobjectliteralmethodsjs">trunk/LayoutTests/js/script-tests/object-literal-methods.js</a></li>
<li><a href="#trunkLayoutTestssputnikConformance07_Lexical_Conventions75_Tokens753_Future_Reserved_WordsS753_A127expectedtxt">trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerNodesCodegencpp">trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserASTBuilderh">trunk/Source/JavaScriptCore/parser/ASTBuilder.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodeConstructorsh">trunk/Source/JavaScriptCore/parser/NodeConstructors.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodesh">trunk/Source/JavaScriptCore/parser/Nodes.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="#trunkSourceJavaScriptCoreparserSyntaxCheckerh">trunk/Source/JavaScriptCore/parser/SyntaxChecker.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgeneratorwithsuperjs">trunk/Source/JavaScriptCore/tests/stress/generator-with-super.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressmodulessyntaxerrorjs">trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresssuperinlexicalscopejs">trunk/Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstresstaggedtemplatessyntaxjs">trunk/Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/ChangeLog        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-04-22 Geoffrey Garen <ggaren@apple.com>
+
+ super should be available in object literals
+ https://bugs.webkit.org/show_bug.cgi?id=156933
+
+ Reviewed by Saam Barati.
+
+ Updated expected results and added a few new tests.
+
+ * js/arrowfunction-syntax-errors-expected.txt:
+ * js/class-syntax-super-expected.txt:
+ * js/object-literal-methods-expected.txt:
+ * js/script-tests/arrowfunction-syntax-errors.js:
+ * js/script-tests/class-syntax-super.js:
+ * js/script-tests/object-literal-methods.js:
+
</ins><span class="cx"> 2016-04-22 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Rebaselining inspector/model/stack-trace.html after r199897
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsyntaxerrorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/arrowfunction-syntax-errors-expected.txt        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -131,20 +131,20 @@
</span><span class="cx"> PASS var arr2 = {a, b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
</span><span class="cx"> PASS var arr3 = {c:a,d:b} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
</span><span class="cx"> PASS var arr3 = {c:b,d:a} => a + b; threw exception SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration..
</span><del>-PASS var arr4 = () => { super(); }; threw exception SyntaxError: Cannot call super() outside of a class constructor..
-PASS var arr4 = () => { super; }; threw exception SyntaxError: Cannot reference super..
-PASS var arr5 = () => { super.getValue(); }; threw exception SyntaxError: super can only be used in a method of a derived class..
-PASS var arr6 = () => super(); threw exception SyntaxError: Cannot call super() outside of a class constructor..
-PASS var arr7 = () => super; threw exception SyntaxError: Cannot reference super..
-PASS var arr8 = () => super.getValue(); threw exception SyntaxError: super can only be used in a method of a derived class..
-PASS class A { constructor() { function a () { return () => { super(); };}} threw exception SyntaxError: Cannot call super() outside of a class constructor..
-PASS class B { constructor() { function b () { return () => { super; }; }; }} threw exception SyntaxError: Cannot reference super..
-PASS class C { constructor() { function c () { return () => { super.getValue(); };}} threw exception SyntaxError: super can only be used in a method of a derived class..
-PASS class D { constructor() { function a () { return () => super(); }} threw exception SyntaxError: Cannot call super() outside of a class constructor..
-PASS class E { constructor() { function b () { return () => super; }; }} threw exception SyntaxError: Cannot reference super..
-PASS class F { constructor() { function c () { return () => 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 () => super.getValue(); }} threw exception SyntaxError: super can only be used in a method of a derived class..
-PASS class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } } threw exception SyntaxError: super can only be used in a method of a derived class..
</del><ins>+PASS var arr4 = () => { super(); }; threw exception SyntaxError: super is not valid in this context..
+PASS var arr4 = () => { super; }; threw exception SyntaxError: super is not valid in this context..
+PASS var arr5 = () => { super.getValue(); }; threw exception SyntaxError: super is not valid in this context..
+PASS var arr6 = () => super(); threw exception SyntaxError: super is not valid in this context..
+PASS var arr7 = () => super; threw exception SyntaxError: super is not valid in this context..
+PASS var arr8 = () => super.getValue(); threw exception SyntaxError: super is not valid in this context..
+PASS class A { constructor() { function a () { return () => { super(); };}} threw exception SyntaxError: super is not valid in this context..
+PASS class B { constructor() { function b () { return () => { super; }; }; }} threw exception SyntaxError: super is not valid in this context..
+PASS class C { constructor() { function c () { return () => { super.getValue(); };}} threw exception SyntaxError: super is not valid in this context..
+PASS class D { constructor() { function a () { return () => super(); }} threw exception SyntaxError: super is not valid in this context..
+PASS class E { constructor() { function b () { return () => super; }; }} threw exception SyntaxError: super is not valid in this context..
+PASS class F { constructor() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context..
+PASS class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }} threw exception SyntaxError: super is not valid in this context..
+PASS class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } } threw exception SyntaxError: super is not valid in this context..
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsclasssyntaxsuperexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/class-syntax-super-expected.txt (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/class-syntax-super-expected.txt        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/class-syntax-super-expected.txt        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -16,8 +16,8 @@
</span><span class="cx"> PASS Derived.staticMethod():::"base3"
</span><span class="cx"> PASS (new SecondDerived).chainMethod().toString():::["base", "derived", "secondDerived"].toString()
</span><span class="cx"> PASS x = class extends Base { constructor() { super(); } super() {} }
</span><del>-PASS x = class extends Base { constructor() { super(); } method() { super() } }:::SyntaxError: Cannot call super() outside of a class constructor.
-PASS x = class extends Base { constructor() { super(); } method() { super } }:::SyntaxError: Cannot reference super.
</del><ins>+PASS x = class extends Base { constructor() { super(); } method() { super() } }:::SyntaxError: super is not valid in this context.
+PASS x = class extends Base { constructor() { super(); } method() { super } }:::SyntaxError: super is not valid in this context.
</ins><span class="cx"> PASS x = class extends Base { constructor() { super(); } method() { return new super } }:::SyntaxError: Cannot use new with super.
</span><span class="cx"> PASS x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } }
</span><span class="cx"> PASS (new x).method1():::ReferenceError: Cannot delete a super property
</span><span class="lines">@@ -37,18 +37,18 @@
</span><span class="cx"> PASS new (class extends null { constructor() { } }):::ReferenceError: Cannot access uninitialized variable.
</span><span class="cx"> PASS new (class extends null { constructor() { return 1; } }):::TypeError: Cannot return a non-object type in the constructor of a derived class.
</span><span class="cx"> PASS new (class extends null { constructor() { super() } }):::TypeError: function is not a constructor (evaluating 'super()')
</span><del>-PASS new (class { constructor() { super() } }):::SyntaxError: Cannot call super() in a base class constructor.
-PASS function x() { super(); }:::SyntaxError: Cannot call super() outside of a class constructor.
-PASS new (class extends Object { constructor() { function x() { super() } } }):::SyntaxError: Cannot call super() outside of a class constructor.
-PASS new (class extends Object { constructor() { function x() { super.method } } }):::SyntaxError: super can only be used in a method of a derived class.
-PASS function x() { super.method(); }:::SyntaxError: super can only be used in a method of a derived class.
-PASS function x() { super(); }:::SyntaxError: Cannot call super() outside of a class constructor.
-PASS eval("super.method()"):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
-PASS eval("super()"):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
-PASS (function () { eval("super.method()");})():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
-PASS (function () { eval("super()");})():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
-PASS new (class { constructor() { (function () { eval("super()");})(); } }):::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
-PASS (new (class { method() { (function () { eval("super.method()");})(); }})).method():::SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
</del><ins>+PASS new (class { constructor() { super() } }):::SyntaxError: super is not valid in this context.
+PASS function x() { super(); }:::SyntaxError: super is not valid in this context.
+PASS new (class extends Object { constructor() { function x() { super() } } }):::SyntaxError: super is not valid in this context.
+PASS new (class extends Object { constructor() { function x() { super.method } } }):::SyntaxError: super is not valid in this context.
+PASS function x() { super.method(); }:::SyntaxError: super is not valid in this context.
+PASS function x() { super(); }:::SyntaxError: super is not valid in this context.
+PASS eval("super.method()"):::SyntaxError: super is not valid in this context.
+PASS eval("super()"):::SyntaxError: super is not valid in this context.
+PASS (function () { eval("super.method()");})():::SyntaxError: super is not valid in this context.
+PASS (function () { eval("super()");})():::SyntaxError: super is not valid in this context.
+PASS new (class { constructor() { (function () { eval("super()");})(); } }):::SyntaxError: super is not valid in this context.
+PASS (new (class { method() { (function () { eval("super.method()");})(); }})).method():::SyntaxError: super is not valid in this context.
</ins><span class="cx"> PASS successfullyParsed
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsobjectliteralmethodsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/object-literal-methods-expected.txt (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/object-literal-methods-expected.txt        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/object-literal-methods-expected.txt        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -68,6 +68,14 @@
</span><span class="cx"> PASS ({__proto__: function(){}}) instanceof Function is true
</span><span class="cx"> PASS ({__proto__(){}}) instanceof Function is false
</span><span class="cx"> PASS ({__proto__(){}}).__proto__ instanceof Function is true
</span><ins>+PASS { f() { return super.f(); } }.f() threw exception SyntaxError: Unexpected token '{'.
+PASS new ({ f() { return super(); }.f) threw exception SyntaxError: super is not valid in this context..
+PASS o = { f() { } }; new ({ __proto__: o, f() { return super(); } }).f threw exception SyntaxError: super is not valid in this context..
+PASS ({ f() { return (() => super.f())(); } }).f() threw exception TypeError: super.f is not a function. (In 'super.f()', 'super.f' is undefined).
+PASS o = { f() { return true; } }; ({ __proto__: o, f() { return super.f(); } }).f() is true
+PASS o = { get p() { return true; } }; ({ __proto__: o, get p() { return super.p; } }).p is true
+PASS o = { set p(p2) { } }; ({ __proto__: o, set p(p2) { super.p = p2; } }).p = true is true
+PASS o = { f() { return true; } }; ({ __proto__: o, f() { return (() => super.f())(); } }).f() is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionsyntaxerrorsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-syntax-errors.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -48,22 +48,22 @@
</span><span class="cx"> shouldThrow('var arr3 = {c:a,d:b} => a + b;');
</span><span class="cx"> shouldThrow('var arr3 = {c:b,d:a} => a + b;');
</span><span class="cx">
</span><del>-shouldThrow('var arr4 = () => { super(); };', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('var arr4 = () => { super; };', '"SyntaxError: Cannot reference super."');
-shouldThrow('var arr5 = () => { super.getValue(); };', '"SyntaxError: super can only be used in a method of a derived class."');
</del><ins>+shouldThrow('var arr4 = () => { super(); };', '"SyntaxError: super is not valid in this context."');
+shouldThrow('var arr4 = () => { super; };', '"SyntaxError: super is not valid in this context."');
+shouldThrow('var arr5 = () => { super.getValue(); };', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><del>-shouldThrow('var arr6 = () => super();', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('var arr7 = () => super;', '"SyntaxError: Cannot reference super."');
-shouldThrow('var arr8 = () => super.getValue();', '"SyntaxError: super can only be used in a method of a derived class."');
</del><ins>+shouldThrow('var arr6 = () => super();', '"SyntaxError: super is not valid in this context."');
+shouldThrow('var arr7 = () => super;', '"SyntaxError: super is not valid in this context."');
+shouldThrow('var arr8 = () => super.getValue();', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><del>-shouldThrow('class A { constructor() { function a () { return () => { super(); };}}', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('class B { constructor() { function b () { return () => { super; }; }; }}', '"SyntaxError: Cannot reference super."');
-shouldThrow('class C { constructor() { function c () { return () => { super.getValue(); };}}', '"SyntaxError: super can only be used in a method of a derived class."');
</del><ins>+shouldThrow('class A { constructor() { function a () { return () => { super(); };}}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class B { constructor() { function b () { return () => { super; }; }; }}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class C { constructor() { function c () { return () => { super.getValue(); };}}', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><del>-shouldThrow('class D { constructor() { function a () { return () => super(); }}', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('class E { constructor() { function b () { return () => super; }; }}', '"SyntaxError: Cannot reference super."');
-shouldThrow('class F { constructor() { function c () { return () => super.getValue(); }}', '"SyntaxError: super can only be used in a method of a derived class."');
-shouldThrow('class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }}', '"SyntaxError: super can only be used in a method of a derived class."');
-shouldThrow('class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } }', '"SyntaxError: super can only be used in a method of a derived class."');
</del><ins>+shouldThrow('class D { constructor() { function a () { return () => super(); }}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class E { constructor() { function b () { return () => super; }; }}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class F { constructor() { function c () { return () => super.getValue(); }}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class G {}; class G2 extends G { getValue() { function c () { return () => super.getValue(); }}', '"SyntaxError: super is not valid in this context."');
+shouldThrow('class H {}; class H2 extends H { method() { function *gen() { let arr = () => super.getValue(); arr(); } } }', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsclasssyntaxsuperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/class-syntax-super.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/class-syntax-super.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/script-tests/class-syntax-super.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -99,8 +99,8 @@
</span><span class="cx"> shouldBe('(new SecondDerived).chainMethod().toString()', '["base", "derived", "secondDerived"].toString()');
</span><span class="cx"> shouldNotThrow('x = class extends Base { constructor() { super(); } super() {} }');
</span><span class="cx"> shouldThrow('x = class extends Base { constructor() { super(); } method() { super() } }',
</span><del>- '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: Cannot reference super."');
</del><ins>+ '"SyntaxError: super is not valid in this context."');
+shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx"> shouldThrow('x = class extends Base { constructor() { super(); } method() { return new super } }', '"SyntaxError: Cannot use new with super."');
</span><span class="cx"> shouldNotThrow('x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } }');
</span><span class="cx"> shouldThrow('(new x).method1()', '"ReferenceError: Cannot delete a super property"');
</span><span class="lines">@@ -120,19 +120,19 @@
</span><span class="cx"> shouldThrow('new (class extends null { constructor() { } })', '"ReferenceError: Cannot access uninitialized variable."');
</span><span class="cx"> shouldThrow('new (class extends null { constructor() { return 1; } })', '"TypeError: Cannot return a non-object type in the constructor of a derived class."');
</span><span class="cx"> shouldThrow('new (class extends null { constructor() { super() } })', '"TypeError: function is not a constructor (evaluating \'super()\')"');
</span><del>-shouldThrow('new (class { constructor() { super() } })', '"SyntaxError: Cannot call super() in a base class constructor."');
-shouldThrow('function x() { super(); }', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('new (class extends Object { constructor() { function x() { super() } } })', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('new (class extends Object { constructor() { function x() { super.method } } })', '"SyntaxError: super can only be used in a method of a derived class."');
-shouldThrow('function x() { super.method(); }', '"SyntaxError: super can only be used in a method of a derived class."');
-shouldThrow('function x() { super(); }', '"SyntaxError: Cannot call super() outside of a class constructor."');
-shouldThrow('eval("super.method()")', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
-shouldThrow('eval("super()")', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
</del><ins>+shouldThrow('new (class { constructor() { super() } })', '"SyntaxError: super is not valid in this context."');
+shouldThrow('function x() { super(); }', '"SyntaxError: super is not valid in this context."');
+shouldThrow('new (class extends Object { constructor() { function x() { super() } } })', '"SyntaxError: super is not valid in this context."');
+shouldThrow('new (class extends Object { constructor() { function x() { super.method } } })', '"SyntaxError: super is not valid in this context."');
+shouldThrow('function x() { super.method(); }', '"SyntaxError: super is not valid in this context."');
+shouldThrow('function x() { super(); }', '"SyntaxError: super is not valid in this context."');
+shouldThrow('eval("super.method()")', '"SyntaxError: super is not valid in this context."');
+shouldThrow('eval("super()")', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><del>-shouldThrow('(function () { eval("super.method()");})()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
-shouldThrow('(function () { eval("super()");})()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
</del><ins>+shouldThrow('(function () { eval("super.method()");})()', '"SyntaxError: super is not valid in this context."');
+shouldThrow('(function () { eval("super()");})()', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><del>-shouldThrow('new (class { constructor() { (function () { eval("super()");})(); } })', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
-shouldThrow('(new (class { method() { (function () { eval("super.method()");})(); }})).method()', '"SyntaxError: \'super\' is only valid inside a function or an \'eval\' inside a function."');
</del><ins>+shouldThrow('new (class { constructor() { (function () { eval("super()");})(); } })', '"SyntaxError: super is not valid in this context."');
+shouldThrow('(new (class { method() { (function () { eval("super.method()");})(); }})).method()', '"SyntaxError: super is not valid in this context."');
</ins><span class="cx">
</span><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsobjectliteralmethodsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/object-literal-methods.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/object-literal-methods.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/js/script-tests/object-literal-methods.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -82,3 +82,12 @@
</span><span class="cx"> shouldBeTrue("({__proto__: function(){}}) instanceof Function");
</span><span class="cx"> shouldBeFalse("({__proto__(){}}) instanceof Function");
</span><span class="cx"> shouldBeTrue("({__proto__(){}}).__proto__ instanceof Function");
</span><ins>+
+shouldThrow("{ f() { return super.f(); } }.f()");
+shouldThrow("new ({ f() { return super(); }.f)");
+shouldThrow("o = { f() { } }; new ({ __proto__: o, f() { return super(); } }).f");
+shouldThrow("({ f() { return (() => super.f())(); } }).f()");
+shouldBeTrue("o = { f() { return true; } }; ({ __proto__: o, f() { return super.f(); } }).f()");
+shouldBeTrue("o = { get p() { return true; } }; ({ __proto__: o, get p() { return super.p; } }).p");
+shouldBeTrue("o = { set p(p2) { } }; ({ __proto__: o, set p(p2) { super.p = p2; } }).p = true");
+shouldBeTrue("o = { f() { return true; } }; ({ __proto__: o, f() { return (() => super.f())(); } }).f()");
</ins></span></pre></div>
<a id="trunkLayoutTestssputnikConformance07_Lexical_Conventions75_Tokens753_Future_Reserved_WordsS753_A127expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/LayoutTests/sputnik/Conformance/07_Lexical_Conventions/7.5_Tokens/7.5.3_Future_Reserved_Words/S7.5.3_A1.27-expected.txt        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-CONSOLE MESSAGE: line 76: SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.
</del><ins>+CONSOLE MESSAGE: line 76: SyntaxError: super is not valid in this context.
</ins><span class="cx"> S7.5.3_A1.27
</span><span class="cx">
</span><span class="cx"> PASS Expected parsing failure
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -1,3 +1,71 @@
</span><ins>+2016-04-22 Geoffrey Garen <ggaren@apple.com>
+
+ super should be available in object literals
+ https://bugs.webkit.org/show_bug.cgi?id=156933
+
+ Reviewed by Saam Barati.
+
+ When we originally implemented classes, super seemed to be a class-only
+ feature. But the final spec says it's available in object literals too.
+
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class
+ property are no longer synonymous, so we track two separate variables.
+
+ (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super
+ branch no longer guarantees that you're a class property, so we decide
+ our attributes and our function name dynamically.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createArrowFunctionExpr):
+ (JSC::ASTBuilder::createGetterOrSetterProperty):
+ (JSC::ASTBuilder::createArguments):
+ (JSC::ASTBuilder::createArgumentsList):
+ (JSC::ASTBuilder::createProperty):
+ (JSC::ASTBuilder::createPropertyList): Pass through state to indicate
+ whether we're a class property, since we can't infer it from 'super'
+ anymore.
+
+ * parser/NodeConstructors.h:
+ (JSC::PropertyNode::PropertyNode): See ASTBuilder.h.
+
+ * parser/Nodes.h:
+ (JSC::PropertyNode::expressionName):
+ (JSC::PropertyNode::name):
+ (JSC::PropertyNode::type):
+ (JSC::PropertyNode::needsSuperBinding):
+ (JSC::PropertyNode::isClassProperty):
+ (JSC::PropertyNode::putType): See ASTBuilder.h.
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseFunctionInfo):
+ (JSC::Parser<LexerType>::parseClass):
+ (JSC::Parser<LexerType>::parseProperty):
+ (JSC::Parser<LexerType>::parsePropertyMethod):
+ (JSC::Parser<LexerType>::parseGetterSetter):
+ (JSC::Parser<LexerType>::parseMemberExpression): I made these error
+ messages generic because it is no longer practical to say concise things
+ about the list of places you can use super.
+
+ * parser/Parser.h:
+
+ * parser/SyntaxChecker.h:
+ (JSC::SyntaxChecker::createArgumentsList):
+ (JSC::SyntaxChecker::createProperty):
+ (JSC::SyntaxChecker::appendExportSpecifier):
+ (JSC::SyntaxChecker::appendConstDecl):
+ (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for
+ interface change.
+
+ * tests/stress/generator-with-super.js:
+ (test):
+ * tests/stress/modules-syntax-error.js:
+ * tests/stress/super-in-lexical-scope.js:
+ (testSyntaxError):
+ (testSyntaxError.test):
+ * tests/stress/tagged-templates-syntax.js: Updated for error message
+ changes. See Parser.cpp.
+
</ins><span class="cx"> 2016-04-22 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> ASSERT(m_stack.last().isTailDeleted) at ShadowChicken.cpp:127 inspecting the inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerNodesCodegencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -498,11 +498,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<RegisterID> value = generator.emitNode(node->m_assign);
</span><del>- bool isClassProperty = node->needsSuperBinding();
- if (isClassProperty)
</del><ins>+ bool needsSuperBinding = node->needsSuperBinding();
+ if (needsSuperBinding)
</ins><span class="cx"> emitPutHomeObject(generator, value.get(), dst);
</span><del>- unsigned attribute = isClassProperty ? (Accessor | DontEnum) : Accessor;
</del><span class="cx">
</span><ins>+ unsigned attributes = node->isClassProperty() ? (Accessor | DontEnum) : Accessor;
+
</ins><span class="cx"> ASSERT(node->m_type & (PropertyNode::Getter | PropertyNode::Setter));
</span><span class="cx">
</span><span class="cx"> // This is a get/set property which may be overridden by a computed property later.
</span><span class="lines">@@ -512,16 +513,16 @@
</span><span class="cx"> RefPtr<RegisterID> propertyName = generator.emitNode(node->m_expression);
</span><span class="cx"> generator.emitSetFunctionNameIfNeeded(node->m_assign, value.get(), propertyName.get());
</span><span class="cx"> if (node->m_type & PropertyNode::Getter)
</span><del>- generator.emitPutGetterByVal(dst, propertyName.get(), attribute, value.get());
</del><ins>+ generator.emitPutGetterByVal(dst, propertyName.get(), attributes, value.get());
</ins><span class="cx"> else
</span><del>- generator.emitPutSetterByVal(dst, propertyName.get(), attribute, value.get());
</del><ins>+ generator.emitPutSetterByVal(dst, propertyName.get(), attributes, value.get());
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (node->m_type & PropertyNode::Getter)
</span><del>- generator.emitPutGetterById(dst, *node->name(), attribute, value.get());
</del><ins>+ generator.emitPutGetterById(dst, *node->name(), attributes, value.get());
</ins><span class="cx"> else
</span><del>- generator.emitPutSetterById(dst, *node->name(), attribute, value.get());
</del><ins>+ generator.emitPutSetterById(dst, *node->name(), attributes, value.get());
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -562,11 +563,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ASSERT(!pair.second || isClassProperty == pair.second->needsSuperBinding());
- if (isClassProperty && pair.second)
</del><ins>+ ASSERT(!pair.second || needsSuperBinding == pair.second->needsSuperBinding());
+ if (needsSuperBinding && pair.second)
</ins><span class="cx"> emitPutHomeObject(generator, secondReg, dst);
</span><span class="cx">
</span><del>- generator.emitPutGetterSetter(dst, *node->name(), attribute, getterReg.get(), setterReg.get());
</del><ins>+ generator.emitPutGetterSetter(dst, *node->name(), attributes, getterReg.get(), setterReg.get());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -585,8 +586,12 @@
</span><span class="cx"> else
</span><span class="cx"> propertyNameRegister = generator.emitNode(node.m_expression);
</span><span class="cx">
</span><ins>+ unsigned attributes = BytecodeGenerator::PropertyConfigurable | BytecodeGenerator::PropertyWritable;
+ if (!node.isClassProperty())
+ attributes |= BytecodeGenerator::PropertyEnumerable;
+ generator.emitSetFunctionNameIfNeeded(node.m_assign, value.get(), propertyNameRegister.get());
</ins><span class="cx"> generator.emitCallDefineProperty(newObj, propertyNameRegister.get(),
</span><del>- value.get(), nullptr, nullptr, BytecodeGenerator::PropertyConfigurable | BytecodeGenerator::PropertyWritable, m_position);
</del><ins>+ value.get(), nullptr, nullptr, attributes, m_position);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (const auto* identifier = node.name()) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserASTBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ASTBuilder.h (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -410,7 +410,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool,
</span><del>- const Identifier* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)
</del><ins>+ const Identifier* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(name);
</span><span class="cx"> functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
</span><span class="lines">@@ -418,27 +418,27 @@
</span><span class="cx"> functionInfo.body->setInferredName(*name);
</span><span class="cx"> SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
</span><span class="cx"> MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source);
</span><del>- return new (m_parserArena) PropertyNode(*name, methodDef, type, PropertyNode::Unknown, superBinding);
</del><ins>+ return new (m_parserArena) PropertyNode(*name, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NEVER_INLINE PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, bool,
</span><del>- ExpressionNode* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)
</del><ins>+ ExpressionNode* name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(name);
</span><span class="cx"> functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
</span><span class="cx"> SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
</span><span class="cx"> MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, m_vm->propertyNames->nullIdentifier, functionInfo.body, source);
</span><del>- return new (m_parserArena) PropertyNode(name, methodDef, type, PropertyNode::Unknown, superBinding);
</del><ins>+ return new (m_parserArena) PropertyNode(name, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NEVER_INLINE PropertyNode* createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation& location, PropertyNode::Type type, bool,
</span><del>- double name, const ParserFunctionInfo<ASTBuilder>& functionInfo, SuperBinding superBinding)
</del><ins>+ double name, const ParserFunctionInfo<ASTBuilder>& functionInfo, bool isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> functionInfo.body->setLoc(functionInfo.startLine, functionInfo.endLine, location.startOffset, location.lineStartOffset);
</span><span class="cx"> const Identifier& ident = parserArena.identifierArena().makeNumericIdentifier(vm, name);
</span><span class="cx"> SourceCode source = m_sourceCode->subExpression(functionInfo.startOffset, functionInfo.endOffset, functionInfo.startLine, functionInfo.bodyStartColumn);
</span><span class="cx"> MethodDefinitionNode* methodDef = new (m_parserArena) MethodDefinitionNode(location, vm->propertyNames->nullIdentifier, functionInfo.body, source);
</span><del>- return new (m_parserArena) PropertyNode(ident, methodDef, type, PropertyNode::Unknown, superBinding);
</del><ins>+ return new (m_parserArena) PropertyNode(ident, methodDef, type, PropertyNode::Unknown, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ArgumentsNode* createArguments() { return new (m_parserArena) ArgumentsNode(); }
</span><span class="lines">@@ -446,7 +446,7 @@
</span><span class="cx"> ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ExpressionNode* arg) { return new (m_parserArena) ArgumentListNode(location, arg); }
</span><span class="cx"> ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ArgumentListNode* args, ExpressionNode* arg) { return new (m_parserArena) ArgumentListNode(location, args, arg); }
</span><span class="cx">
</span><del>- PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded)
</del><ins>+ PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> if (node->isFuncExprNode()) {
</span><span class="cx"> auto metadata = static_cast<FuncExprNode*>(node)->metadata();
</span><span class="lines">@@ -454,13 +454,13 @@
</span><span class="cx"> metadata->setInferredName(*propertyName);
</span><span class="cx"> } else if (node->isClassExprNode())
</span><span class="cx"> static_cast<ClassExprNode*>(node)->setEcmaName(*propertyName);
</span><del>- return new (m_parserArena) PropertyNode(*propertyName, node, type, putType, superBinding);
</del><ins>+ return new (m_parserArena) PropertyNode(*propertyName, node, type, putType, superBinding, isClassProperty);
</ins><span class="cx"> }
</span><del>- PropertyNode* createProperty(VM* vm, ParserArena& parserArena, double propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool)
</del><ins>+ PropertyNode* createProperty(VM* vm, ParserArena& parserArena, double propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty)
</ins><span class="cx"> {
</span><del>- return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType);
</del><ins>+ return new (m_parserArena) PropertyNode(parserArena.identifierArena().makeNumericIdentifier(vm, propertyName), node, type, putType, superBinding, isClassProperty);
</ins><span class="cx"> }
</span><del>- PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding = SuperBinding::NotNeeded) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding); }
</del><ins>+ PropertyNode* createProperty(ExpressionNode* propertyName, ExpressionNode* node, PropertyNode::Type type, PropertyNode::PutType putType, bool, SuperBinding superBinding, bool isClassProperty) { return new (m_parserArena) PropertyNode(propertyName, node, type, putType, superBinding, isClassProperty); }
</ins><span class="cx"> PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_parserArena) PropertyListNode(location, property); }
</span><span class="cx"> PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_parserArena) PropertyListNode(location, property, tail); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodeConstructorsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/NodeConstructors.h (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/NodeConstructors.h        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/NodeConstructors.h        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -220,22 +220,24 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding = SuperBinding::NotNeeded)
</del><ins>+ inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, bool isClassProperty)
</ins><span class="cx"> : m_name(&name)
</span><span class="cx"> , m_assign(assign)
</span><span class="cx"> , m_type(type)
</span><span class="cx"> , m_needsSuperBinding(superBinding == SuperBinding::Needed)
</span><span class="cx"> , m_putType(putType)
</span><ins>+ , m_isClassProperty(isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding = SuperBinding::NotNeeded)
</del><ins>+ inline PropertyNode::PropertyNode(ExpressionNode* name, ExpressionNode* assign, Type type, PutType putType, SuperBinding superBinding, bool isClassProperty)
</ins><span class="cx"> : m_name(0)
</span><span class="cx"> , m_expression(name)
</span><span class="cx"> , m_assign(assign)
</span><span class="cx"> , m_type(type)
</span><span class="cx"> , m_needsSuperBinding(superBinding == SuperBinding::Needed)
</span><span class="cx"> , m_putType(putType)
</span><ins>+ , m_isClassProperty(isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Nodes.h (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Nodes.h        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/Nodes.h        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -626,14 +626,15 @@
</span><span class="cx"> enum Type { Constant = 1, Getter = 2, Setter = 4, Computed = 8, Shorthand = 16 };
</span><span class="cx"> enum PutType { Unknown, KnownDirect };
</span><span class="cx">
</span><del>- PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding);
- PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding);
</del><ins>+ PropertyNode(const Identifier&, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty);
+ PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type, PutType, SuperBinding, bool isClassProperty);
</ins><span class="cx">
</span><span class="cx"> ExpressionNode* expressionName() const { return m_expression; }
</span><span class="cx"> const Identifier* name() const { return m_name; }
</span><span class="cx">
</span><span class="cx"> Type type() const { return static_cast<Type>(m_type); }
</span><span class="cx"> bool needsSuperBinding() const { return m_needsSuperBinding; }
</span><ins>+ bool isClassProperty() const { return m_isClassProperty; }
</ins><span class="cx"> PutType putType() const { return static_cast<PutType>(m_putType); }
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -644,6 +645,7 @@
</span><span class="cx"> unsigned m_type : 5;
</span><span class="cx"> unsigned m_needsSuperBinding : 1;
</span><span class="cx"> unsigned m_putType : 1;
</span><ins>+ unsigned m_isClassProperty: 1;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class PropertyListNode : public ExpressionNode {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -2078,9 +2078,9 @@
</span><span class="cx"> if (generatorBodyScope->strictMode())
</span><span class="cx"> functionScope->setStrictMode();
</span><span class="cx">
</span><del>- semanticFailIfTrue(generatorBodyScope->hasDirectSuper(), "Cannot call super() outside of a class constructor");
</del><ins>+ semanticFailIfTrue(generatorBodyScope->hasDirectSuper(), "super is not valid in this context");
</ins><span class="cx"> if (generatorBodyScope->needsSuperBinding())
</span><del>- semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, "super can only be used in a method of a derived class");
</del><ins>+ semanticFailIfTrue(expectedSuperBinding == SuperBinding::NotNeeded, "super is not valid in this context");
</ins><span class="cx">
</span><span class="cx"> popScope(generatorBodyScope, TreeBuilder::NeedsFreeVariableInfo);
</span><span class="cx"> } else
</span><span class="lines">@@ -2103,15 +2103,15 @@
</span><span class="cx"> ConstructorKind functionConstructorKind = functionBodyType == StandardFunctionBodyBlock && !scopeRef->isEvalContext()
</span><span class="cx"> ? constructorKind
</span><span class="cx"> : scopeRef->constructorKind();
</span><del>- semanticFailIfTrue(functionConstructorKind == ConstructorKind::None, "Cannot call super() outside of a class constructor");
- semanticFailIfTrue(functionConstructorKind != ConstructorKind::Derived, "Cannot call super() in a base class constructor");
</del><ins>+ semanticFailIfTrue(functionConstructorKind == ConstructorKind::None, "super is not valid in this context");
+ semanticFailIfTrue(functionConstructorKind != ConstructorKind::Derived, "super is not valid in this context");
</ins><span class="cx"> }
</span><span class="cx"> if (functionScope->needsSuperBinding()) {
</span><span class="cx"> ScopeRef scopeRef = closestParentOrdinaryFunctionNonLexicalScope();
</span><span class="cx"> SuperBinding functionSuperBinding = functionBodyType == StandardFunctionBodyBlock && !scopeRef->isEvalContext()
</span><span class="cx"> ? expectedSuperBinding
</span><span class="cx"> : scopeRef->expectedSuperBinding();
</span><del>- semanticFailIfTrue(functionSuperBinding == SuperBinding::NotNeeded, "super can only be used in a method of a derived class");
</del><ins>+ semanticFailIfTrue(functionSuperBinding == SuperBinding::NotNeeded, "super is not valid in this context");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2335,8 +2335,9 @@
</span><span class="cx"> TreeProperty property;
</span><span class="cx"> const bool alwaysStrictInsideClass = true;
</span><span class="cx"> if (isGetter || isSetter) {
</span><ins>+ bool isClassProperty = true;
</ins><span class="cx"> property = parseGetterSetter(context, alwaysStrictInsideClass, isGetter ? PropertyNode::Getter : PropertyNode::Setter, methodStart,
</span><del>- ConstructorKind::None, SuperBinding::Needed);
</del><ins>+ ConstructorKind::None, isClassProperty);
</ins><span class="cx"> failIfFalse(property, "Cannot parse this method");
</span><span class="cx"> } else {
</span><span class="cx"> ParserFunctionInfo<TreeBuilder> methodInfo;
</span><span class="lines">@@ -2361,11 +2362,13 @@
</span><span class="cx"> // FIXME: Syntax error when super() is called
</span><span class="cx"> semanticFailIfTrue(isStaticMethod && methodInfo.name && *methodInfo.name == propertyNames.prototype,
</span><span class="cx"> "Cannot declare a static method named 'prototype'");
</span><ins>+
+ bool isClassProperty = true;
</ins><span class="cx"> if (computedPropertyName) {
</span><span class="cx"> property = context.createProperty(computedPropertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed),
</span><del>- PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
</del><ins>+ PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> } else
</span><del>- property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed);
</del><ins>+ property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, PropertyNode::Unknown, alwaysStrictInsideClass, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TreePropertyList& tail = isStaticMethod ? staticMethodsTail : instanceMethodsTail;
</span><span class="lines">@@ -3257,6 +3260,7 @@
</span><span class="cx"> {
</span><span class="cx"> bool wasIdent = false;
</span><span class="cx"> bool isGenerator = false;
</span><ins>+ bool isClassProperty = false;
</ins><span class="cx"> #if ENABLE(ES6_GENERATORS)
</span><span class="cx"> if (consume(TIMES))
</span><span class="cx"> isGenerator = true;
</span><span class="lines">@@ -3279,13 +3283,13 @@
</span><span class="cx"> TreeExpression node = parseAssignmentExpressionOrPropagateErrorClass(context);
</span><span class="cx"> failIfFalse(node, "Cannot parse expression for property declaration");
</span><span class="cx"> context.setEndOffset(node, m_lexer->currentOffset());
</span><del>- return context.createProperty(ident, node, PropertyNode::Constant, PropertyNode::Unknown, complete);
</del><ins>+ return context.createProperty(ident, node, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (match(OPENPAREN)) {
</span><span class="cx"> auto method = parsePropertyMethod(context, ident, isGenerator);
</span><span class="cx"> propagateError();
</span><del>- return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete);
</del><ins>+ return context.createProperty(ident, method, PropertyNode::Constant, PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> failIfTrue(isGenerator, "Expected a parenthesis for argument list");
</span><span class="cx">
</span><span class="lines">@@ -3298,7 +3302,7 @@
</span><span class="cx"> if (currentScope()->isArrowFunction())
</span><span class="cx"> currentScope()->setInnerArrowFunctionUsesEval();
</span><span class="cx"> TreeExpression node = context.createResolve(location, *ident, start, lastTokenEndPosition());
</span><del>- return context.createProperty(ident, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Shorthand), PropertyNode::KnownDirect, complete);
</del><ins>+ return context.createProperty(ident, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Shorthand), PropertyNode::KnownDirect, complete, SuperBinding::NotNeeded, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (match(EQUAL)) // CoverInitializedName is exclusive to BindingPattern and AssignmentPattern
</span><span class="lines">@@ -3311,7 +3315,7 @@
</span><span class="cx"> type = PropertyNode::Setter;
</span><span class="cx"> else
</span><span class="cx"> failWithMessage("Expected a ':' following the property name '", ident->impl(), "'");
</span><del>- return parseGetterSetter(context, complete, type, getterOrSetterStartOffset);
</del><ins>+ return parseGetterSetter(context, complete, type, getterOrSetterStartOffset, ConstructorKind::None, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> case DOUBLE:
</span><span class="cx"> case INTEGER: {
</span><span class="lines">@@ -3322,7 +3326,7 @@
</span><span class="cx"> const Identifier& ident = m_parserArena.identifierArena().makeNumericIdentifier(const_cast<VM*>(m_vm), propertyName);
</span><span class="cx"> auto method = parsePropertyMethod(context, &ident, isGenerator);
</span><span class="cx"> propagateError();
</span><del>- return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete);
</del><ins>+ return context.createProperty(&ident, method, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> failIfTrue(isGenerator, "Expected a parenthesis for argument list");
</span><span class="cx">
</span><span class="lines">@@ -3330,7 +3334,7 @@
</span><span class="cx"> TreeExpression node = parseAssignmentExpression(context);
</span><span class="cx"> failIfFalse(node, "Cannot parse expression for property declaration");
</span><span class="cx"> context.setEndOffset(node, m_lexer->currentOffset());
</span><del>- return context.createProperty(const_cast<VM*>(m_vm), m_parserArena, propertyName, node, PropertyNode::Constant, PropertyNode::Unknown, complete);
</del><ins>+ return context.createProperty(const_cast<VM*>(m_vm), m_parserArena, propertyName, node, PropertyNode::Constant, PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> case OPENBRACKET: {
</span><span class="cx"> next();
</span><span class="lines">@@ -3341,7 +3345,7 @@
</span><span class="cx"> if (match(OPENPAREN)) {
</span><span class="cx"> auto method = parsePropertyMethod(context, &m_vm->propertyNames->nullIdentifier, isGenerator);
</span><span class="cx"> propagateError();
</span><del>- return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete);
</del><ins>+ return context.createProperty(propertyName, method, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::KnownDirect, complete, SuperBinding::Needed, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> failIfTrue(isGenerator, "Expected a parenthesis for argument list");
</span><span class="cx">
</span><span class="lines">@@ -3349,7 +3353,7 @@
</span><span class="cx"> TreeExpression node = parseAssignmentExpression(context);
</span><span class="cx"> failIfFalse(node, "Cannot parse expression for property declaration");
</span><span class="cx"> context.setEndOffset(node, m_lexer->currentOffset());
</span><del>- return context.createProperty(propertyName, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::Unknown, complete);
</del><ins>+ return context.createProperty(propertyName, node, static_cast<PropertyNode::Type>(PropertyNode::Constant | PropertyNode::Computed), PropertyNode::Unknown, complete, SuperBinding::NotNeeded, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx"> default:
</span><span class="cx"> failIfFalse(m_token.m_type & KeywordTokenFlag, "Expected a property name");
</span><span class="lines">@@ -3364,14 +3368,14 @@
</span><span class="cx"> unsigned methodStart = tokenStart();
</span><span class="cx"> ParserFunctionInfo<TreeBuilder> methodInfo;
</span><span class="cx"> SourceParseMode parseMode = isGenerator ? SourceParseMode::GeneratorWrapperFunctionMode : SourceParseMode::MethodMode;
</span><del>- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::NotNeeded, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method");
</del><ins>+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, parseMode, false, ConstructorKind::None, SuperBinding::Needed, methodStart, methodInfo, FunctionDefinitionType::Method)), "Cannot parse this method");
</ins><span class="cx"> methodInfo.name = methodName;
</span><span class="cx"> return context.createMethodDefinition(methodLocation, methodInfo);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename LexerType>
</span><span class="cx"> template <class TreeBuilder> TreeProperty Parser<LexerType>::parseGetterSetter(TreeBuilder& context, bool strict, PropertyNode::Type type, unsigned getterOrSetterStartOffset,
</span><del>- ConstructorKind constructorKind, SuperBinding superBinding)
</del><ins>+ ConstructorKind constructorKind, bool isClassProperty)
</ins><span class="cx"> {
</span><span class="cx"> const Identifier* stringPropertyName = 0;
</span><span class="cx"> double numericPropertyName = 0;
</span><span class="lines">@@ -3381,9 +3385,9 @@
</span><span class="cx">
</span><span class="cx"> if (matchSpecIdentifier() || match(STRING) || m_token.m_type & KeywordTokenFlag) {
</span><span class="cx"> stringPropertyName = m_token.m_data.ident;
</span><del>- semanticFailIfTrue(superBinding == SuperBinding::Needed && *stringPropertyName == m_vm->propertyNames->prototype,
</del><ins>+ semanticFailIfTrue(isClassProperty && *stringPropertyName == m_vm->propertyNames->prototype,
</ins><span class="cx"> "Cannot declare a static method named 'prototype'");
</span><del>- semanticFailIfTrue(superBinding == SuperBinding::Needed && *stringPropertyName == m_vm->propertyNames->constructor,
</del><ins>+ semanticFailIfTrue(isClassProperty && *stringPropertyName == m_vm->propertyNames->constructor,
</ins><span class="cx"> "Cannot declare a getter or setter named 'constructor'");
</span><span class="cx"> next();
</span><span class="cx"> } else if (match(DOUBLE) || match(INTEGER)) {
</span><span class="lines">@@ -3400,19 +3404,19 @@
</span><span class="cx"> ParserFunctionInfo<TreeBuilder> info;
</span><span class="cx"> if (type & PropertyNode::Getter) {
</span><span class="cx"> failIfFalse(match(OPENPAREN), "Expected a parameter list for getter definition");
</span><del>- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::GetterMode, false, constructorKind, superBinding, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse getter definition");
</del><ins>+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::GetterMode, false, constructorKind, SuperBinding::Needed, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse getter definition");
</ins><span class="cx"> } else {
</span><span class="cx"> failIfFalse(match(OPENPAREN), "Expected a parameter list for setter definition");
</span><del>- failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::SetterMode, false, constructorKind, superBinding, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse setter definition");
</del><ins>+ failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SourceParseMode::SetterMode, false, constructorKind, SuperBinding::Needed, getterOrSetterStartOffset, info, FunctionDefinitionType::Method)), "Cannot parse setter definition");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (stringPropertyName)
</span><del>- return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, superBinding);
</del><ins>+ return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, isClassProperty);
</ins><span class="cx">
</span><span class="cx"> if (computedPropertyName)
</span><del>- return context.createGetterOrSetterProperty(location, static_cast<PropertyNode::Type>(type | PropertyNode::Computed), strict, computedPropertyName, info, superBinding);
</del><ins>+ return context.createGetterOrSetterProperty(location, static_cast<PropertyNode::Type>(type | PropertyNode::Computed), strict, computedPropertyName, info, isClassProperty);
</ins><span class="cx">
</span><del>- return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, strict, numericPropertyName, info, superBinding);
</del><ins>+ return context.createGetterOrSetterProperty(const_cast<VM*>(m_vm), m_parserArena, location, type, strict, numericPropertyName, info, isClassProperty);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename LexerType>
</span><span class="lines">@@ -3894,7 +3898,7 @@
</span><span class="cx">
</span><span class="cx"> if (baseIsSuper) {
</span><span class="cx"> ScopeRef scopeRef = closestParentOrdinaryFunctionNonLexicalScope();
</span><del>- semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), "'super' is only valid inside a function or an 'eval' inside a function");
</del><ins>+ semanticFailIfFalse(currentScope()->isFunction() || (scopeRef->isEvalContext() && scopeRef->expectedSuperBinding() == SuperBinding::Needed), "super is not valid in this context");
</ins><span class="cx"> base = context.createSuperExpr(location);
</span><span class="cx"> next();
</span><span class="cx"> currentFunctionScope()->setNeedsSuperBinding();
</span><span class="lines">@@ -3972,7 +3976,7 @@
</span><span class="cx"> baseIsSuper = false;
</span><span class="cx"> }
</span><span class="cx"> endMemberExpression:
</span><del>- semanticFailIfTrue(baseIsSuper, "Cannot reference super");
</del><ins>+ semanticFailIfTrue(baseIsSuper, "super is not valid in this context");
</ins><span class="cx"> while (newCount--)
</span><span class="cx"> base = context.createNewExpr(location, base, expressionStart, lastTokenEndPosition());
</span><span class="cx"> return base;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -1388,7 +1388,7 @@
</span><span class="cx"> template <class TreeBuilder> ALWAYS_INLINE TreeExpression parseArgument(TreeBuilder&, ArgumentType&);
</span><span class="cx"> template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict);
</span><span class="cx"> template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName, bool isGenerator);
</span><del>- template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded);
</del><ins>+ template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind, bool isClassProperty);
</ins><span class="cx"> template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, const JSTokenLocation&, int, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, SuperBinding, FunctionBodyType, unsigned, SourceParseMode);
</span><span class="cx"> template <class TreeBuilder> ALWAYS_INLINE bool parseFormalParameters(TreeBuilder&, TreeFormalParameterList, unsigned&);
</span><span class="cx"> enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSyntaxCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SyntaxChecker.h (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -202,20 +202,20 @@
</span><span class="cx">
</span><span class="cx"> int createArgumentsList(const JSTokenLocation&, int) { return ArgumentsListResult; }
</span><span class="cx"> int createArgumentsList(const JSTokenLocation&, int, int) { return ArgumentsListResult; }
</span><del>- Property createProperty(const Identifier* name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding = SuperBinding::NotNeeded)
</del><ins>+ Property createProperty(const Identifier* name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding, bool)
</ins><span class="cx"> {
</span><span class="cx"> if (!complete)
</span><span class="cx"> return Property(type);
</span><span class="cx"> ASSERT(name);
</span><span class="cx"> return Property(name, type);
</span><span class="cx"> }
</span><del>- Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete)
</del><ins>+ Property createProperty(VM* vm, ParserArena& parserArena, double name, int, PropertyNode::Type type, PropertyNode::PutType, bool complete, SuperBinding, bool)
</ins><span class="cx"> {
</span><span class="cx"> if (!complete)
</span><span class="cx"> return Property(type);
</span><span class="cx"> return Property(&parserArena.identifierArena().makeNumericIdentifier(vm, name), type);
</span><span class="cx"> }
</span><del>- Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding = SuperBinding::NotNeeded)
</del><ins>+ Property createProperty(int, int, PropertyNode::Type type, PropertyNode::PutType, bool, SuperBinding, bool)
</ins><span class="cx"> {
</span><span class="cx"> return Property(type);
</span><span class="cx"> }
</span><span class="lines">@@ -269,18 +269,18 @@
</span><span class="cx"> void appendExportSpecifier(ExportSpecifierList, ExportSpecifier) { }
</span><span class="cx">
</span><span class="cx"> int appendConstDecl(const JSTokenLocation&, int, const Identifier*, int) { return StatementResult; }
</span><del>- Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)
</del><ins>+ Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool strict, const Identifier* name, const ParserFunctionInfo<SyntaxChecker>&, bool)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(name);
</span><span class="cx"> if (!strict)
</span><span class="cx"> return Property(type);
</span><span class="cx"> return Property(name, type);
</span><span class="cx"> }
</span><del>- Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool, int, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)
</del><ins>+ Property createGetterOrSetterProperty(const JSTokenLocation&, PropertyNode::Type type, bool, int, const ParserFunctionInfo<SyntaxChecker>&, bool)
</ins><span class="cx"> {
</span><span class="cx"> return Property(type);
</span><span class="cx"> }
</span><del>- Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, const ParserFunctionInfo<SyntaxChecker>&, SuperBinding)
</del><ins>+ Property createGetterOrSetterProperty(VM* vm, ParserArena& parserArena, const JSTokenLocation&, PropertyNode::Type type, bool strict, double name, const ParserFunctionInfo<SyntaxChecker>&, bool)
</ins><span class="cx"> {
</span><span class="cx"> if (!strict)
</span><span class="cx"> return Property(type);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgeneratorwithsuperjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/generator-with-super.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/generator-with-super.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/tests/stress/generator-with-super.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> return eval('super');
</span><span class="cx"> }
</span><span class="cx">
</span><del>- shouldThrow(() => test(), "SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.");
</del><ins>+ shouldThrow(() => test(), "SyntaxError: super is not valid in this context.");
</ins><span class="cx"> }());
</span><span class="cx">
</span><span class="cx"> (function () {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressmodulessyntaxerrorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/tests/stress/modules-syntax-error.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -307,12 +307,12 @@
</span><span class="cx">
</span><span class="cx"> checkModuleSyntaxError(String.raw`
</span><span class="cx"> super();
</span><del>-`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);
</del><ins>+`, `SyntaxError: super is not valid in this context.:2`);
</ins><span class="cx">
</span><span class="cx"> checkModuleSyntaxError(String.raw`
</span><span class="cx"> super.test();
</span><del>-`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);
</del><ins>+`, `SyntaxError: super is not valid in this context.:2`);
</ins><span class="cx">
</span><span class="cx"> checkModuleSyntaxError(String.raw`
</span><span class="cx"> super.test = 20;
</span><del>-`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.:2`);
</del><ins>+`, `SyntaxError: super is not valid in this context.:2`);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresssuperinlexicalscopejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/tests/stress/super-in-lexical-scope.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -18,33 +18,33 @@
</span><span class="cx"> throw new Error("Expected syntax error not thrown");
</span><span class="cx">
</span><span class="cx"> if (String(error) !== message)
</span><del>- throw new Error("Bad error: " + String(error));
</del><ins>+ throw new Error("Bad error: " + String(error) + "(Expected: " + message + ")");
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-testSyntaxError(`super()`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);
-testSyntaxError(`super.hello()`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);
</del><ins>+testSyntaxError(`super()`, `SyntaxError: super is not valid in this context.`);
+testSyntaxError(`super.hello()`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx"> }
</span><del>-`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> {
</span><span class="cx"> super.hello();
</span><span class="cx"> }
</span><del>-`, `SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx"> }
</span><del>-`, `SyntaxError: Cannot call super() outside of a class constructor.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx"> super.hello();
</span><span class="cx"> }
</span><del>-`, `SyntaxError: super can only be used in a method of a derived class.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> super();
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-`, `SyntaxError: Cannot call super() outside of a class constructor.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins><span class="cx"> testSyntaxError(`
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="lines">@@ -60,4 +60,4 @@
</span><span class="cx"> super.hello();
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-`, `SyntaxError: super can only be used in a method of a derived class.`);
</del><ins>+`, `SyntaxError: super is not valid in this context.`);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstresstaggedtemplatessyntaxjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js (199926 => 199927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js        2016-04-22 23:04:35 UTC (rev 199926)
+++ trunk/Source/JavaScriptCore/tests/stress/tagged-templates-syntax.js        2016-04-22 23:04:55 UTC (rev 199927)
</span><span class="lines">@@ -66,5 +66,5 @@
</span><span class="cx"> testSyntax("(class extends Hello { constructor() { super()`${tag} ${tag}` } })");
</span><span class="cx"> testSyntax("(class extends Hello { constructor() { super()`${tag}${tag}` } })");
</span><span class="cx">
</span><del>-testSyntaxError("super`Hello${tag}`", "SyntaxError: 'super' is only valid inside a function or an 'eval' inside a function.");
</del><ins>+testSyntaxError("super`Hello${tag}`", "SyntaxError: super is not valid in this context.");
</ins><span class="cx"> testSyntaxError("(class { say() { super`Hello${tag}` } })", "SyntaxError: Cannot use super as tag for tagged templates.");
</span></span></pre>
</div>
</div>
</body>
</html>