Bug 144238

Summary: Class contructor and methods shouldn't have "arguments" and "caller"
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, gskachkov, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 140491    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch rniwa: review+

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.