RESOLVED FIXED 142390
ES6: Object Literal Extensions - Methods
https://bugs.webkit.org/show_bug.cgi?id=142390
Summary ES6: Object Literal Extensions - Methods
Joseph Pecoraro
Reported 2015-03-06 01:33:42 PST
* SUMMARY Object Literal Extensions - Methods. > ObjectLiteral[Yield] : {} > { PropertyDefinitionList[?Yield] } > { PropertyDefinitionList[?Yield] , } > > PropertyDefinitionList: > PropertyDefinition[?Yield] > ... > > PropertyDefinition[?Yield] > ... > MethodDefinition[?Yield] > > MethodDefinition[Yield] : > PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } Example: var o = { foo() { return 10; }, bar(a, b) { return a + b; }, 100() { return 100; }, 'method'() { return 0; }, }; This is pretty much identical to class methods, just for object literals.
Attachments
[PATCH] Proposed Fix (12.39 KB, patch)
2015-03-06 01:38 PST, Joseph Pecoraro
no flags
[PATCH] For Bots (26.18 KB, patch)
2015-03-06 01:39 PST, Joseph Pecoraro
no flags
[PATCH] Proposed Fix - With Computed Method Names (22.95 KB, patch)
2015-03-06 12:06 PST, Joseph Pecoraro
no flags
[PATCH] Proposed Fix - With Computed Method Names (23.16 KB, patch)
2015-03-06 13:38 PST, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2015-03-06 01:38:40 PST
Created attachment 248054 [details] [PATCH] Proposed Fix Requires a patch not yet landed (the PutType stuff).
Joseph Pecoraro
Comment 2 2015-03-06 01:39:57 PST
Created attachment 248055 [details] [PATCH] For Bots
Joseph Pecoraro
Comment 3 2015-03-06 10:54:47 PST
It should be trivial to extend this to support computed methods as well: var o = { ["foo" + "bar"]() { return 10; } }; o.foobar(); Since it is highly related, I'll put up a new patch.
Joseph Pecoraro
Comment 4 2015-03-06 12:06:10 PST
Created attachment 248085 [details] [PATCH] Proposed Fix - With Computed Method Names Still requires a previous change, so this won't build on the bots.
Joseph Pecoraro
Comment 5 2015-03-06 13:38:38 PST
Created attachment 248095 [details] [PATCH] Proposed Fix - With Computed Method Names
Geoffrey Garen
Comment 6 2015-03-06 13:48:00 PST
Comment on attachment 248095 [details] [PATCH] Proposed Fix - With Computed Method Names r=me
WebKit Commit Bot
Comment 7 2015-03-06 14:31:54 PST
Comment on attachment 248095 [details] [PATCH] Proposed Fix - With Computed Method Names Clearing flags on attachment: 248095 Committed r181183: <http://trac.webkit.org/changeset/181183>
WebKit Commit Bot
Comment 8 2015-03-06 14:31:59 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.