Bug 156933 - super should be available in object literals
Summary: super should be available in object literals
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-22 15:24 PDT by Geoffrey Garen
Modified: 2016-04-22 16:04 PDT (History)
6 users (show)

See Also:


Attachments
Patch (61.72 KB, patch)
2016-04-22 15:33 PDT, Geoffrey Garen
sbarati: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2016-04-22 15:24:42 PDT
super should be available in object literals
Comment 1 Geoffrey Garen 2016-04-22 15:33:17 PDT
Created attachment 277107 [details]
Patch
Comment 2 Saam Barati 2016-04-22 15:46:18 PDT
Comment on attachment 277107 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277107&action=review

r=me with comments.

> Source/JavaScriptCore/ChangeLog:48
> +        about the list of places you can use super.

I agree. I wish our parser added the line/column to the "super not allowed in this context" error message.

> LayoutTests/js/script-tests/object-literal-methods.js:91
> +shouldThrow("{ f() { return super.f(); } }.f()");
> +shouldThrow("new ({ f() { return super(); }.f)");
> +shouldThrow("o = { f() { } }; new ({ __proto__: o, f() { return super(); } }).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");

Can you also add some tests for arrow functions to make sure they close over 'super' properly in object literal method syntax?
Comment 3 Geoffrey Garen 2016-04-22 16:04:31 PDT
Committed r199927: <http://trac.webkit.org/changeset/199927>