Bug 157461 - ES6: Classes: Should be allowed to assign values to static method with name "arguments" and "caller"
Summary: ES6: Classes: Should be allowed to assign values to static method with name "...
Status: RESOLVED DUPLICATE of bug 163579
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 152985
Blocks: 140491
  Show dependency treegraph
 
Reported: 2016-05-08 02:05 PDT by GSkachkov
Modified: 2021-05-14 04:51 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description GSkachkov 2016-05-08 02:05:35 PDT
class C { 
    static caller() { return 'abc'; } 
}

C.caller(); // abc
C.caller = function () { return 'cba'; };
C.caller(); // cab

C.arguments = function () {} ??? // In Chrome && Firefox - TypeError
Comment 1 Alexey Shvayka 2021-05-14 04:51:58 PDT
(In reply to GSkachkov from comment #0)
> class C { 
>     static caller() { return 'abc'; } 
> }

r225845 fixed JSFunction::put() and JSFunction::defineOwnProperty() to perform ordinary [[Set]] / [[DefineOwnProperty]] for classes and strict functions.
I am adding this test case as part of https://bugs.webkit.org/show_bug.cgi?id=225277.

> C.arguments = function () {} ??? // In Chrome && Firefox - TypeError

This throws TypeError because of https://tc39.es/ecma262/#sec-addrestrictedfunctionproperties.

*** This bug has been marked as a duplicate of bug 163579 ***