<!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>[194881] 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/194881">194881</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-11 19:02:07 -0800 (Mon, 11 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>keywords ("super", "delete", etc) should be valid method names
https://bugs.webkit.org/show_bug.cgi?id=144281
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-01-11
Reviewed by Ryosuke Niwa.
Source/JavaScriptCore:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseClass):
- When parsing "static(" treat it as a method named "static" and not a static method.
- When parsing a keyword treat it like a string method name (get and set are not keywords)
- When parsing a getter / setter method name identifier, allow lookahead to be a keyword
(JSC::Parser<LexerType>::parseGetterSetter):
- When parsing the getter / setter's name, allow it to be a keyword.
LayoutTests:
* js/class-syntax-super-expected.txt:
* js/script-tests/class-syntax-super.js:
Update the test for the correct expected result.
* js/keyword-method-names-expected.txt: Added.
* js/keyword-method-names.html: Added.
* js/script-tests/keyword-method-names.js: Added.
Add tests to cover parsing allows keywords in method name syntax.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsclasssyntaxsuperexpectedtxt">trunk/LayoutTests/js/class-syntax-super-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsclasssyntaxsuperjs">trunk/LayoutTests/js/script-tests/class-syntax-super.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>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjskeywordmethodnamesexpectedtxt">trunk/LayoutTests/js/keyword-method-names-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjskeywordmethodnameshtml">trunk/LayoutTests/js/keyword-method-names.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestskeywordmethodnamesjs">trunk/LayoutTests/js/script-tests/keyword-method-names.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194880 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-12 02:12:37 UTC (rev 194880)
+++ trunk/LayoutTests/ChangeLog        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-01-11 Joseph Pecoraro <pecoraro@apple.com>
+
+ keywords ("super", "delete", etc) should be valid method names
+ https://bugs.webkit.org/show_bug.cgi?id=144281
+
+ Reviewed by Ryosuke Niwa.
+
+ * js/class-syntax-super-expected.txt:
+ * js/script-tests/class-syntax-super.js:
+ Update the test for the correct expected result.
+
+ * js/keyword-method-names-expected.txt: Added.
+ * js/keyword-method-names.html: Added.
+ * js/script-tests/keyword-method-names.js: Added.
+ Add tests to cover parsing allows keywords in method name syntax.
+
</ins><span class="cx"> 2016-01-11 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: storage/indexeddb/intversion-long-queue.html fails.
</span></span></pre></div>
<a id="trunkLayoutTestsjsclasssyntaxsuperexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/class-syntax-super-expected.txt (194880 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/class-syntax-super-expected.txt        2016-01-12 02:12:37 UTC (rev 194880)
+++ trunk/LayoutTests/js/class-syntax-super-expected.txt        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> PASS (new Derived).baseMethodInGetterSetter = 1; valueInSetter:::(new Base).baseMethod
</span><span class="cx"> PASS Derived.staticMethod():::"base3"
</span><span class="cx"> PASS (new SecondDerived).chainMethod().toString():::["base", "derived", "secondDerived"].toString()
</span><del>-PASS x = class extends Base { constructor() { super(); } super() {} }:::SyntaxError: Unexpected keyword 'super'
</del><ins>+PASS x = class extends Base { constructor() { super(); } super() {} }
</ins><span class="cx"> PASS x = class extends Base { constructor() { super(); } method() { super() } }:::SyntaxError: Cannot call super() outside of a class constructor.
</span><span class="cx"> PASS x = class extends Base { constructor() { super(); } method() { super } }:::SyntaxError: Cannot reference super.
</span><span class="cx"> PASS x = class extends Base { constructor() { super(); } method() { return new super } }:::SyntaxError: Cannot use new with super.
</span></span></pre></div>
<a id="trunkLayoutTestsjskeywordmethodnamesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/keyword-method-names-expected.txt (0 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/keyword-method-names-expected.txt         (rev 0)
+++ trunk/LayoutTests/js/keyword-method-names-expected.txt        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Tests for ES6 method syntax in classes and object literals with keyword names
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjskeywordmethodnameshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/keyword-method-names.html (0 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/keyword-method-names.html         (rev 0)
+++ trunk/LayoutTests/js/keyword-method-names.html        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/js-test-pre.js"></script>
+<script src="script-tests/keyword-method-names.js"></script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsclasssyntaxsuperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/class-syntax-super.js (194880 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/class-syntax-super.js        2016-01-12 02:12:37 UTC (rev 194880)
+++ trunk/LayoutTests/js/script-tests/class-syntax-super.js        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx"> shouldBe('(new Derived).baseMethodInGetterSetter = 1; valueInSetter', '(new Base).baseMethod');
</span><span class="cx"> shouldBe('Derived.staticMethod()', '"base3"');
</span><span class="cx"> shouldBe('(new SecondDerived).chainMethod().toString()', '["base", "derived", "secondDerived"].toString()');
</span><del>-shouldThrow('x = class extends Base { constructor() { super(); } super() {} }', '"SyntaxError: Unexpected keyword \'super\'"');
</del><ins>+shouldNotThrow('x = class extends Base { constructor() { super(); } super() {} }');
</ins><span class="cx"> shouldThrow('x = class extends Base { constructor() { super(); } method() { super() } }',
</span><span class="cx"> '"SyntaxError: Cannot call super() outside of a class constructor."');
</span><span class="cx"> shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: Cannot reference super."');
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestskeywordmethodnamesjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/keyword-method-names.js (0 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/keyword-method-names.js         (rev 0)
+++ trunk/LayoutTests/js/script-tests/keyword-method-names.js        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -0,0 +1,496 @@
</span><ins>+description('Tests for ES6 method syntax in classes and object literals with keyword names');
+
+// Tests keywords / reserved words, and also some non-reserved words with special meaning (in, of, get, set).
+
+class ClassWithKeywordMethodNames {
+ constructor() { } // NOTE: This has semantic meaning here, but is allowed.
+ abstract() { }
+ arguments() { }
+ boolean() { }
+ break() { }
+ byte() { }
+ case() { }
+ catch() { }
+ char() { }
+ class() { }
+ const() { }
+ continue() { }
+ debugger() { }
+ default() { }
+ delete() { }
+ do() { }
+ double() { }
+ else() { }
+ enum() { }
+ eval() { }
+ export() { }
+ extends() { }
+ false() { }
+ final() { }
+ finally() { }
+ float() { }
+ for() { }
+ function() { }
+ get() { }
+ goto() { }
+ if() { }
+ implements() { }
+ import() { }
+ in() { }
+ instanceof() { }
+ int() { }
+ interface() { }
+ let() { }
+ long() { }
+ native() { }
+ new() { }
+ null() { }
+ package() { }
+ private() { }
+ protected() { }
+ public() { }
+ of() { }
+ return() { }
+ set() { }
+ short() { }
+ static() { }
+ super() { }
+ switch() { }
+ synchronized() { }
+ this() { }
+ throw() { }
+ throws() { }
+ transient() { }
+ true() { }
+ try() { }
+ typeof() { }
+ var() { }
+ void() { }
+ volatile() { }
+ while() { }
+ with() { }
+ yield() { }
+};
+
+class ClassWithKeywordStaticMethodNames {
+ static constructor() { }
+ static abstract() { }
+ // FIXME: <https://webkit.org/b/152985> ES6: Classes: Should be allowed to create a static method with name "arguments"
+ // static arguments() { }
+ static boolean() { }
+ static break() { }
+ static byte() { }
+ static case() { }
+ static catch() { }
+ static char() { }
+ static class() { }
+ static const() { }
+ static continue() { }
+ static debugger() { }
+ static default() { }
+ static delete() { }
+ static do() { }
+ static double() { }
+ static else() { }
+ static enum() { }
+ static eval() { }
+ static export() { }
+ static extends() { }
+ static false() { }
+ static final() { }
+ static finally() { }
+ static float() { }
+ static for() { }
+ static function() { }
+ static get() { }
+ static goto() { }
+ static if() { }
+ static implements() { }
+ static import() { }
+ static in() { }
+ static instanceof() { }
+ static int() { }
+ static interface() { }
+ static let() { }
+ static long() { }
+ static native() { }
+ static new() { }
+ static null() { }
+ static package() { }
+ static private() { }
+ static protected() { }
+ static public() { }
+ static of() { }
+ static return() { }
+ static set() { }
+ static short() { }
+ static static() { }
+ static super() { }
+ static switch() { }
+ static synchronized() { }
+ static this() { }
+ static throw() { }
+ static throws() { }
+ static transient() { }
+ static true() { }
+ static try() { }
+ static typeof() { }
+ static var() { }
+ static void() { }
+ static volatile() { }
+ static while() { }
+ static with() { }
+ static yield() { }
+};
+
+class ClassWithKeywordGetterMethodNames {
+ // get constructor() { } (getter `constructor` not allowed)
+ get abstract() { }
+ get arguments() { }
+ get boolean() { }
+ get break() { }
+ get byte() { }
+ get case() { }
+ get catch() { }
+ get char() { }
+ get class() { }
+ get const() { }
+ get continue() { }
+ get debugger() { }
+ get default() { }
+ get delete() { }
+ get do() { }
+ get double() { }
+ get else() { }
+ get enum() { }
+ get eval() { }
+ get export() { }
+ get extends() { }
+ get false() { }
+ get final() { }
+ get finally() { }
+ get float() { }
+ get for() { }
+ get function() { }
+ get get() { }
+ get goto() { }
+ get if() { }
+ get implements() { }
+ get import() { }
+ get in() { }
+ get instanceof() { }
+ get int() { }
+ get interface() { }
+ get let() { }
+ get long() { }
+ get native() { }
+ get new() { }
+ get null() { }
+ get package() { }
+ get private() { }
+ get protected() { }
+ get public() { }
+ get of() { }
+ get return() { }
+ get set() { }
+ get short() { }
+ get static() { }
+ get super() { }
+ get switch() { }
+ get synchronized() { }
+ get this() { }
+ get throw() { }
+ get throws() { }
+ get transient() { }
+ get true() { }
+ get try() { }
+ get typeof() { }
+ get var() { }
+ get void() { }
+ get volatile() { }
+ get while() { }
+ get with() { }
+ get yield() { }
+};
+
+class ClassWithKeywordSetterMethodNames {
+ // set constructor() { } (setter `constructor` not allowed)
+ set abstract(x) { }
+ set arguments(x) { }
+ set boolean(x) { }
+ set break(x) { }
+ set byte(x) { }
+ set case(x) { }
+ set catch(x) { }
+ set char(x) { }
+ set class(x) { }
+ set const(x) { }
+ set continue(x) { }
+ set debugger(x) { }
+ set default(x) { }
+ set delete(x) { }
+ set do(x) { }
+ set double(x) { }
+ set else(x) { }
+ set enum(x) { }
+ set eval(x) { }
+ set export(x) { }
+ set extends(x) { }
+ set false(x) { }
+ set final(x) { }
+ set finally(x) { }
+ set float(x) { }
+ set for(x) { }
+ set function(x) { }
+ set get(x) { }
+ set goto(x) { }
+ set if(x) { }
+ set implements(x) { }
+ set import(x) { }
+ set in(x) { }
+ set instanceof(x) { }
+ set int(x) { }
+ set interface(x) { }
+ set let(x) { }
+ set long(x) { }
+ set native(x) { }
+ set new(x) { }
+ set null(x) { }
+ set package(x) { }
+ set private(x) { }
+ set protected(x) { }
+ set public(x) { }
+ set of(x) { }
+ set return(x) { }
+ set set(x) { }
+ set short(x) { }
+ set static(x) { }
+ set super(x) { }
+ set switch(x) { }
+ set synchronized(x) { }
+ set this(x) { }
+ set throw(x) { }
+ set throws(x) { }
+ set transient(x) { }
+ set true(x) { }
+ set try(x) { }
+ set typeof(x) { }
+ set var(x) { }
+ set void(x) { }
+ set volatile(x) { }
+ set while(x) { }
+ set with(x) { }
+ set yield(x) { }
+};
+
+var objectLiteralWithKeywordMethodNames = {
+ constructor() { },
+ abstract() { },
+ arguments() { },
+ boolean() { },
+ break() { },
+ byte() { },
+ case() { },
+ catch() { },
+ char() { },
+ class() { },
+ const() { },
+ continue() { },
+ debugger() { },
+ default() { },
+ delete() { },
+ do() { },
+ double() { },
+ else() { },
+ enum() { },
+ eval() { },
+ export() { },
+ extends() { },
+ false() { },
+ final() { },
+ finally() { },
+ float() { },
+ for() { },
+ function() { },
+ get() { },
+ goto() { },
+ if() { },
+ implements() { },
+ import() { },
+ in() { },
+ instanceof() { },
+ int() { },
+ interface() { },
+ let() { },
+ long() { },
+ native() { },
+ new() { },
+ null() { },
+ package() { },
+ private() { },
+ protected() { },
+ public() { },
+ of() { },
+ return() { },
+ set() { },
+ short() { },
+ static() { },
+ super() { },
+ switch() { },
+ synchronized() { },
+ this() { },
+ throw() { },
+ throws() { },
+ transient() { },
+ true() { },
+ try() { },
+ typeof() { },
+ var() { },
+ void() { },
+ volatile() { },
+ while() { },
+ with() { },
+ yield() { },
+};
+
+var objectLiteralWithKeywordGetterNames = {
+ get constructor() { },
+ get abstract() { },
+ get arguments() { },
+ get boolean() { },
+ get break() { },
+ get byte() { },
+ get case() { },
+ get catch() { },
+ get char() { },
+ get class() { },
+ get const() { },
+ get continue() { },
+ get debugger() { },
+ get default() { },
+ get delete() { },
+ get do() { },
+ get double() { },
+ get else() { },
+ get enum() { },
+ get eval() { },
+ get export() { },
+ get extends() { },
+ get false() { },
+ get final() { },
+ get finally() { },
+ get float() { },
+ get for() { },
+ get function() { },
+ get get() { },
+ get goto() { },
+ get if() { },
+ get implements() { },
+ get import() { },
+ get in() { },
+ get instanceof() { },
+ get int() { },
+ get interface() { },
+ get let() { },
+ get long() { },
+ get native() { },
+ get new() { },
+ get null() { },
+ get package() { },
+ get private() { },
+ get protected() { },
+ get public() { },
+ get of() { },
+ get return() { },
+ get set() { },
+ get short() { },
+ get static() { },
+ get super() { },
+ get switch() { },
+ get synchronized() { },
+ get this() { },
+ get throw() { },
+ get throws() { },
+ get transient() { },
+ get true() { },
+ get try() { },
+ get typeof() { },
+ get var() { },
+ get void() { },
+ get volatile() { },
+ get while() { },
+ get with() { },
+ get yield() { },
+};
+
+var objectLiteralWithKeywordSetterNames = {
+ set constructor(x) { },
+ set abstract(x) { },
+ set arguments(x) { },
+ set boolean(x) { },
+ set break(x) { },
+ set byte(x) { },
+ set case(x) { },
+ set catch(x) { },
+ set char(x) { },
+ set class(x) { },
+ set const(x) { },
+ set continue(x) { },
+ set debugger(x) { },
+ set default(x) { },
+ set delete(x) { },
+ set do(x) { },
+ set double(x) { },
+ set else(x) { },
+ set enum(x) { },
+ set eval(x) { },
+ set export(x) { },
+ set extends(x) { },
+ set false(x) { },
+ set final(x) { },
+ set finally(x) { },
+ set float(x) { },
+ set for(x) { },
+ set function(x) { },
+ set get(x) { },
+ set goto(x) { },
+ set if(x) { },
+ set implements(x) { },
+ set import(x) { },
+ set in(x) { },
+ set instanceof(x) { },
+ set int(x) { },
+ set interface(x) { },
+ set let(x) { },
+ set long(x) { },
+ set native(x) { },
+ set new(x) { },
+ set null(x) { },
+ set package(x) { },
+ set private(x) { },
+ set protected(x) { },
+ set public(x) { },
+ set of(x) { },
+ set return(x) { },
+ set set(x) { },
+ set short(x) { },
+ set static(x) { },
+ set super(x) { },
+ set switch(x) { },
+ set synchronized(x) { },
+ set this(x) { },
+ set throw(x) { },
+ set throws(x) { },
+ set transient(x) { },
+ set true(x) { },
+ set try(x) { },
+ set typeof(x) { },
+ set var(x) { },
+ set void(x) { },
+ set volatile(x) { },
+ set while(x) { },
+ set with(x) { },
+ set yield(x) { },
+};
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (194880 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-01-12 02:12:37 UTC (rev 194880)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-01-11 Joseph Pecoraro <pecoraro@apple.com>
+
+ keywords ("super", "delete", etc) should be valid method names
+ https://bugs.webkit.org/show_bug.cgi?id=144281
+
+ Reviewed by Ryosuke Niwa.
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseClass):
+ - When parsing "static(" treat it as a method named "static" and not a static method.
+ - When parsing a keyword treat it like a string method name (get and set are not keywords)
+ - When parsing a getter / setter method name identifier, allow lookahead to be a keyword
+
+ (JSC::Parser<LexerType>::parseGetterSetter):
+ - When parsing the getter / setter's name, allow it to be a keyword.
+
</ins><span class="cx"> 2016-01-11 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> [JSC] Add Div/Mod and fix Mul for B3 ARM64
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (194880 => 194881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-01-12 02:12:37 UTC (rev 194880)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-01-12 03:02:07 UTC (rev 194881)
</span><span class="lines">@@ -2148,9 +2148,16 @@
</span><span class="cx"> unsigned methodStart = tokenStart();
</span><span class="cx">
</span><span class="cx"> // For backwards compatibility, "static" is a non-reserved keyword in non-strict mode.
</span><del>- bool isStaticMethod = match(RESERVED_IF_STRICT) && *m_token.m_data.ident == m_vm->propertyNames->staticKeyword;
- if (isStaticMethod)
</del><ins>+ bool isStaticMethod = false;
+ if (match(RESERVED_IF_STRICT) && *m_token.m_data.ident == m_vm->propertyNames->staticKeyword) {
+ auto savePoint = createSavePoint();
</ins><span class="cx"> next();
</span><ins>+ if (match(OPENPAREN)) {
+ // Reparse "static()" as a method named "static".
+ restoreSavePoint(savePoint);
+ } else
+ isStaticMethod = true;
+ }
</ins><span class="cx">
</span><span class="cx"> // FIXME: Figure out a way to share more code with parseProperty.
</span><span class="cx"> const CommonIdentifiers& propertyNames = *m_vm->propertyNames;
</span><span class="lines">@@ -2164,6 +2171,7 @@
</span><span class="cx"> isGenerator = true;
</span><span class="cx"> #endif
</span><span class="cx"> switch (m_token.m_type) {
</span><ins>+ namedKeyword:
</ins><span class="cx"> case STRING:
</span><span class="cx"> ident = m_token.m_data.ident;
</span><span class="cx"> ASSERT(ident);
</span><span class="lines">@@ -2173,7 +2181,7 @@
</span><span class="cx"> ident = m_token.m_data.ident;
</span><span class="cx"> ASSERT(ident);
</span><span class="cx"> next();
</span><del>- if (!isGenerator && (match(IDENT) || match(STRING) || match(DOUBLE) || match(INTEGER) || match(OPENBRACKET))) {
</del><ins>+ if (!isGenerator && (matchIdentifierOrKeyword() || match(STRING) || match(DOUBLE) || match(INTEGER) || match(OPENBRACKET))) {
</ins><span class="cx"> isGetter = *ident == propertyNames.get;
</span><span class="cx"> isSetter = *ident == propertyNames.set;
</span><span class="cx"> }
</span><span class="lines">@@ -2191,6 +2199,8 @@
</span><span class="cx"> handleProductionOrFail(CLOSEBRACKET, "]", "end", "computed property name");
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><ins>+ if (m_token.m_type & KeywordTokenFlag)
+ goto namedKeyword;
</ins><span class="cx"> failDueToUnexpectedToken();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3200,7 +3210,7 @@
</span><span class="cx">
</span><span class="cx"> JSTokenLocation location(tokenLocation());
</span><span class="cx">
</span><del>- if (matchSpecIdentifier() || match(STRING)) {
</del><ins>+ if (matchSpecIdentifier() || match(STRING) || m_token.m_type & KeywordTokenFlag) {
</ins><span class="cx"> stringPropertyName = m_token.m_data.ident;
</span><span class="cx"> semanticFailIfTrue(superBinding == SuperBinding::Needed && *stringPropertyName == m_vm->propertyNames->prototype,
</span><span class="cx"> "Cannot declare a static method named 'prototype'");
</span></span></pre>
</div>
</div>
</body>
</html>