https://bugs.webkit.org/show_bug.cgi?id=144282
Reviewed by Joseph Pecoraro.
Source/JavaScriptCore:
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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183757
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-05-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ 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 <simon.fraser@apple.com>
Skip fast/images/animated-gif-body-outside-viewport.html on Windows. It
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.
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"');
+2015-05-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ 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 <saambarati1@gmail.com>
JSCallbackObject does not maintain symmetry between accesses for getOwnPropertySlot and put
#if ENABLE(ES6_CLASS_SYNTAX)
bool baseIsSuper = match(SUPER);
+ semanticFailIfTrue(baseIsSuper && newCount, "Cannot use new with super");
#else
bool baseIsSuper = false;
#endif
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;