Bug 156933

Summary: super should be available in object literals
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: New BugsAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, keith_miller, mark.lam, msaboff, rniwa, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch saam: review+

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>