Title: [183757] trunk
- Revision
- 183757
- Author
- [email protected]
- Date
- 2015-05-04 12:21:28 -0700 (Mon, 04 May 2015)
Log Message
new super should be a syntax error
https://bugs.webkit.org/show_bug.cgi?id=144282
Reviewed by Joseph Pecoraro.
Source/_javascript_Core:
Disallow "new super" as ES6 spec doesn't allow this.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseMemberExpression):
LayoutTests:
Rebaselined the test.
* js/class-syntax-super-expected.txt:
* js/script-tests/class-syntax-super.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (183756 => 183757)
--- trunk/LayoutTests/ChangeLog 2015-05-04 19:17:34 UTC (rev 183756)
+++ trunk/LayoutTests/ChangeLog 2015-05-04 19:21:28 UTC (rev 183757)
@@ -1,3 +1,15 @@
+2015-05-04 Ryosuke Niwa <[email protected]>
+
+ new super should be a syntax error
+ https://bugs.webkit.org/show_bug.cgi?id=144282
+
+ Reviewed by Joseph Pecoraro.
+
+ Rebaselined the test.
+
+ * js/class-syntax-super-expected.txt:
+ * js/script-tests/class-syntax-super.js:
+
2015-05-04 Simon Fraser <[email protected]>
Skip fast/images/animated-gif-body-outside-viewport.html on Windows. It
Modified: trunk/LayoutTests/js/class-syntax-super-expected.txt (183756 => 183757)
--- trunk/LayoutTests/js/class-syntax-super-expected.txt 2015-05-04 19:17:34 UTC (rev 183756)
+++ trunk/LayoutTests/js/class-syntax-super-expected.txt 2015-05-04 19:21:28 UTC (rev 183757)
@@ -16,9 +16,7 @@
PASS x = class extends Base { constructor() { super(); } super() {} } threw exception SyntaxError: Unexpected keyword 'super'.
PASS x = class extends Base { constructor() { super(); } method() { super() } } threw exception SyntaxError: Cannot call super() outside of a class constructor..
PASS x = class extends Base { constructor() { super(); } method() { super } } threw exception SyntaxError: Cannot reference super..
-PASS x = class extends Base { constructor() { super(); } method() { return new super } } did not throw exception.
-PASS (new x).method() instanceof Base is true
-PASS (new x).method() instanceof x is false
+PASS x = class extends Base { constructor() { super(); } method() { return new super } } threw exception SyntaxError: Cannot use new with super..
PASS x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } } did not throw exception.
PASS (new x).method1() threw exception ReferenceError: Cannot delete a super property.
PASS (new x).method2() threw exception ReferenceError: Cannot delete a super property.
Modified: trunk/LayoutTests/js/script-tests/class-syntax-super.js (183756 => 183757)
--- trunk/LayoutTests/js/script-tests/class-syntax-super.js 2015-05-04 19:17:34 UTC (rev 183756)
+++ trunk/LayoutTests/js/script-tests/class-syntax-super.js 2015-05-04 19:21:28 UTC (rev 183757)
@@ -41,9 +41,7 @@
shouldThrow('x = class extends Base { constructor() { super(); } method() { super() } }',
'"SyntaxError: Cannot call super() outside of a class constructor."');
shouldThrow('x = class extends Base { constructor() { super(); } method() { super } }', '"SyntaxError: Cannot reference super."');
-shouldNotThrow('x = class extends Base { constructor() { super(); } method() { return new super } }');
-shouldBeTrue('(new x).method() instanceof Base');
-shouldBeFalse('(new x).method() instanceof x');
+shouldThrow('x = class extends Base { constructor() { super(); } method() { return new super } }', '"SyntaxError: Cannot use new with super."');
shouldNotThrow('x = class extends Base { constructor() { super(); } method1() { delete (super.foo) } method2() { delete super["foo"] } }');
shouldThrow('(new x).method1()', '"ReferenceError: Cannot delete a super property"');
shouldThrow('(new x).method2()', '"ReferenceError: Cannot delete a super property"');
Modified: trunk/Source/_javascript_Core/ChangeLog (183756 => 183757)
--- trunk/Source/_javascript_Core/ChangeLog 2015-05-04 19:17:34 UTC (rev 183756)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-05-04 19:21:28 UTC (rev 183757)
@@ -1,3 +1,15 @@
+2015-05-04 Ryosuke Niwa <[email protected]>
+
+ new super should be a syntax error
+ https://bugs.webkit.org/show_bug.cgi?id=144282
+
+ Reviewed by Joseph Pecoraro.
+
+ Disallow "new super" as ES6 spec doesn't allow this.
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseMemberExpression):
+
2015-05-04 Saam Barati <[email protected]>
JSCallbackObject does not maintain symmetry between accesses for getOwnPropertySlot and put
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (183756 => 183757)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2015-05-04 19:17:34 UTC (rev 183756)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2015-05-04 19:21:28 UTC (rev 183757)
@@ -2524,6 +2524,7 @@
#if ENABLE(ES6_CLASS_SYNTAX)
bool baseIsSuper = match(SUPER);
+ semanticFailIfTrue(baseIsSuper && newCount, "Cannot use new with super");
#else
bool baseIsSuper = false;
#endif
@@ -2587,7 +2588,7 @@
baseIsSuper = false;
}
endMemberExpression:
- semanticFailIfTrue(baseIsSuper && !newCount, "Cannot reference super");
+ semanticFailIfTrue(baseIsSuper, "Cannot reference super");
while (newCount--)
base = context.createNewExpr(location, base, expressionStart, lastTokenEndPosition());
return base;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes