* 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.
Created attachment 248054 [details] [PATCH] Proposed Fix Requires a patch not yet landed (the PutType stuff).
Created attachment 248055 [details] [PATCH] For Bots
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.
Created attachment 248085 [details] [PATCH] Proposed Fix - With Computed Method Names Still requires a previous change, so this won't build on the bots.
Created attachment 248095 [details] [PATCH] Proposed Fix - With Computed Method Names
Comment on attachment 248095 [details] [PATCH] Proposed Fix - With Computed Method Names r=me
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>
All reviewed patches have been landed. Closing bug.