Bug 17020

Summary: Function.toString does not parenthesise numbers for the bracket accessor
Product: WebKit Reporter: Oliver Hunt <oliver>
Component: JavaScriptCoreAssignee: Oliver Hunt <oliver>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, jruderman
Priority: P2 Keywords: HasReduction
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 13638    
Attachments:
Description Flags
Fixeration
darin: review+
updated patch
none
Updated fix mjs: review+

Oliver Hunt
Reported 2008-01-26 04:45:33 PST
In the example function f() { (-1)[0]; } f.toString() produces: function f() { -1[0]; } which is invalid JS
Attachments
Fixeration (7.82 KB, patch)
2008-01-26 05:44 PST, Oliver Hunt
darin: review+
updated patch (5.97 KB, patch)
2008-01-26 11:23 PST, Sam Weinig
no flags
Updated fix (6.38 KB, patch)
2008-01-26 17:03 PST, Oliver Hunt
mjs: review+
Oliver Hunt
Comment 1 2008-01-26 05:36:39 PST
Hmm, it would appear we get it wrong for all of the bracket nodes..
Oliver Hunt
Comment 2 2008-01-26 05:44:40 PST
Created attachment 18707 [details] Fixeration
Darin Adler
Comment 3 2008-01-26 08:15:01 PST
Comment on attachment 18707 [details] Fixeration r=me
Sam Weinig
Comment 4 2008-01-26 11:23:03 PST
Created attachment 18710 [details] updated patch Since I broke Ollie's patch with a little cleanup, I went ahead and updated this patch to work with the new code.
Oliver Hunt
Comment 5 2008-01-26 17:03:26 PST
Created attachment 18713 [details] Updated fix This is a minor update to the prior patch to ensure "new (1)()" will work
Maciej Stachowiak
Comment 6 2008-01-26 18:12:51 PST
Comment on attachment 18713 [details] Updated fix r=me
Oliver Hunt
Comment 7 2008-01-26 18:17:45 PST
Fixed in r29813
Note You need to log in before you can comment on or make changes to this bug.