Bug 144238 - Class contructor and methods shouldn't have "arguments" and "caller"
Summary: Class contructor and methods shouldn't have "arguments" and "caller"
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 140491
  Show dependency treegraph
 
Reported: 2015-04-26 16:00 PDT by Ryosuke Niwa
Modified: 2016-05-05 22:23 PDT (History)
8 users (show)

See Also:


Attachments
Patch (17.78 KB, patch)
2016-05-01 02:36 PDT, GSkachkov
no flags Details | Formatted Diff | Diff
Patch (18.95 KB, patch)
2016-05-01 02:56 PDT, GSkachkov
no flags Details | Formatted Diff | Diff
Patch (18.88 KB, patch)
2016-05-01 03:06 PDT, GSkachkov
no flags Details | Formatted Diff | Diff
Patch (16.44 KB, patch)
2016-05-01 03:26 PDT, GSkachkov
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2015-04-26 16:00:05 PDT
Apparently ES6 gutted "arguments" property from class constructors and methods.
Authors should also be able to define a property named "arguments";
e.g.
class A {
  static arguments() {}
}
class B {
  static get arguments() {}
}
Comment 1 Ryosuke Niwa 2015-04-26 16:46:13 PDT
Same goes for "caller".
Comment 2 GSkachkov 2016-05-01 02:36:14 PDT
Created attachment 277849 [details]
Patch
Comment 3 GSkachkov 2016-05-01 02:56:59 PDT
Created attachment 277850 [details]
Patch

Patch for review
Comment 4 GSkachkov 2016-05-01 03:06:31 PDT
Created attachment 277851 [details]
Patch

Small improvement
Comment 5 GSkachkov 2016-05-01 03:26:45 PDT
Created attachment 277854 [details]
Patch

Remove debug code
Comment 6 GSkachkov 2016-05-01 03:40:05 PDT
I think define arguments property should be fixed in separate patch, we already has one https://bugs.webkit.org/show_bug.cgi?id=152985
Comment 7 Ryosuke Niwa 2016-05-01 14:52:07 PDT
Comment on attachment 277854 [details]
Patch

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

> LayoutTests/js/script-tests/class-method-and-constructor-properties.js:55
> +  caller() { return 'value'; }

How about staric ones?
Comment 8 Ryosuke Niwa 2016-05-01 14:53:16 PDT
(In reply to comment #7)
> Comment on attachment 277854 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=277854&action=review
> 
> > LayoutTests/js/script-tests/class-method-and-constructor-properties.js:55
> > +  caller() { return 'value'; }
> 
> How about staric ones?

Oh, never mind. Didn't see the comment there
Comment 9 Ryosuke Niwa 2016-05-01 14:54:21 PDT
Comment on attachment 277854 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSFunction.cpp:371
> +                GetterSetter* errorGetterSetter = thisObject->jsExecutable()->isClassConstructorFunction() || thisObject->jsExecutable()->parseMode() == SourceParseMode::MethodMode

Please add a static local helper function instead of duplicating the code.
Comment 10 GSkachkov 2016-05-02 05:46:11 PDT
(In reply to comment #9)
> Comment on attachment 277854 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=277854&action=review
> 
> > Source/JavaScriptCore/runtime/JSFunction.cpp:371
> > +                GetterSetter* errorGetterSetter = thisObject->jsExecutable()->isClassConstructorFunction() || thisObject->jsExecutable()->parseMode() == SourceParseMode::MethodMode
> 
> Please add a static local helper function instead of duplicating the code.

Done
Comment 11 GSkachkov 2016-05-02 05:47:28 PDT
Committed r 200321: <http://trac.webkit.org/changeset/200321>
Comment 12 Ryosuke Niwa 2016-05-05 22:22:30 PDT
Closing the bug since the patch was landed in http://trac.webkit.org/changeset/200321.