WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
17018
Incorrect code generated from Function.toString for get/setters in object literals
https://bugs.webkit.org/show_bug.cgi?id=17018
Summary
Incorrect code generated from Function.toString for get/setters in object lit...
Oliver Hunt
Reported
2008-01-26 03:38:42 PST
If you have a function: function f() { ({ set g(x){} }); } Then f.toString will produce incorrect (non-compilable) output as it quotes the identifier string: function f() { ({ set "g"(x){} }); } Found by jsfunfuzz -- maybe i had recopmilation set to not test these cases when i was running these?
Attachments
Patch!
(3.84 KB, patch)
2008-01-26 04:41 PST
,
Oliver Hunt
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2008-01-26 03:58:17 PST
Fix appears to be diff --git a/JavaScriptCore/kjs/nodes2string.cpp b/JavaScriptCore/kjs/nodes2string.cpp index 0432b7f..79a0675 100644 --- a/JavaScriptCore/kjs/nodes2string.cpp +++ b/JavaScriptCore/kjs/nodes2string.cpp @@ -370,11 +370,11 @@ void PropertyNode::streamTo(SourceStream& s) const case Setter: { const FuncExprNode* func = static_cast<const FuncExprNode*>(assign.get()); if (type == Getter) - s << "get \""; + s << "get "; else - s << "set \""; + s << "set "; s << escapeStringForPrettyPrinting(name().ustring()) - << "\"(" << func->param << ')' << func->body; + << "(" << func->param << ')' << func->body; break; } } But I can't see why they were ever escaped strings -- is there a case i am missing where 'set "foo"(x)' would be valid?
Oliver Hunt
Comment 2
2008-01-26 04:41:26 PST
Created
attachment 18706
[details]
Patch!
Darin Adler
Comment 3
2008-01-26 08:13:46 PST
Comment on
attachment 18706
[details]
Patch! r=me What about getters and setters with unusual names?
Oliver Hunt
Comment 4
2008-02-01 00:00:44 PST
Fixed in
r29812
Jesse Ruderman
Comment 5
2008-02-11 17:04:44 PST
***
Bug 13621
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug