* SUMMARY Setter should have a single formal parameter. It should not allow no parameters or multiple parameters. This has actually been the case since ES5. ES6 allows that single parameter to be a binding element (deconstructing parameter): https://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions > MethodDefinition[Yield] : > set PropertyName ( PropertySetParameterList ) { FunctionBody } > > PropertySetParameterList : > FormalParameter > > FormalParameter : > BindingElement * TEST js> var x = { set foo() {} }; * EXPECTED SyntaxError * ACTUAL No error. * NOTES - This would be a breaking change, but I'm not worried since other browsers throw errors: - Firefox throws an error: SyntaxError: setter functions must have one argument - Chrome throws an error: Uncaught SyntaxError: Unexpected token )
Oh, at the same time, getters should have no parameters: > MethodDefinition : > get PropertyName ( ) { FunctionBody }
Created attachment 249096 [details] [PATCH] Proposed Fix
<rdar://problem/20236675>
This looks scary. There could be iOS or Mac specific content that rely on our current behavior. Perhaps we should only do it in the strict mode?
Still needs review!
Comment on attachment 249096 [details] [PATCH] Proposed Fix r=me Is this what other browsers do?
> Is this what other browsers do? Yep! > * NOTES > - This would be a breaking change, but I'm not worried since other browsers throw errors: > - Firefox throws an error: SyntaxError: setter functions must have one argument > - Chrome throws an error: Uncaught SyntaxError: Unexpected token )
Comment on attachment 249096 [details] [PATCH] Proposed Fix Rejecting attachment 249096 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-02', 'apply-attachment', '--no-update', '--non-interactive', 249096, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: 1 with fuzz 3. patching file Source/JavaScriptCore/parser/Parser.cpp Hunk #1 FAILED at 1316. 1 out of 1 hunk FAILED -- saving rejects to file Source/JavaScriptCore/parser/Parser.cpp.rej patching file Source/WebInspectorUI/ChangeLog Hunk #1 succeeded at 1 with fuzz 3. patching file Source/WebInspectorUI/UserInterface/Views/GradientSlider.js Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Geoffrey Garen']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.appspot.com/results/4632901421367296
<http://trac.webkit.org/changeset/181929>