Closed Bug 1242662 Opened 8 years ago Closed 8 years ago

Mismatched parens in uneval of function created with bind()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox47 --- wontfix
firefox50 --- fixed

People

(Reporter: jruderman, Assigned: till)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files)

> var f = (function(){}).bind();
> uneval(f)

(function () {
    [native code]
}
$ ~/funfuzz/autobisect-js/autoBisect.py --build="--enable-more-deterministic --enable-debug --without-intl-api" -o FAIL -p 1.js

The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/f29f1d9a3cd3
user:        Till Schneidereit
summary:     Bug 1000780 - Part 5: Self-host Function.prototype.bind. r=jandem
Flags: needinfo?(till)
Amazing that we didn't have a test for this.
Attachment #8712228 - Flags: review?(jdemooij)
Assignee: nobody → till
Status: NEW → ASSIGNED
Flags: needinfo?(till)
Comment on attachment 8712228 [details] [diff] [review]
Don't emit opening paren for decompiled bound function

Review of attachment 8712228 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/tests/ecma_5/Function/function-bind.js
@@ +261,5 @@
>  
>  testBound(strict);
>  testBound(nonstrict);
>  
> +assertEq((function unbound(){"body"}).bind().toString(), `function unbound() {

AFAICS, toString works as expected but toSource/uneval is broken, because toString calls FunctionToString with lambdaParen = true, and in that case we never add parentheses.

That's really confusing because I'd expect lambdaParen = true to mean "add parentheses", not the other way around :(

Anyways, the toString test is good to have, but maybe also add one for toSource/uneval, even though these are non-standard
Attachment #8712228 - Flags: review?(jdemooij) → review+
Till, is this one ready to land?
Flags: needinfo?(till)
There's no way we're going to uplift this to beta, even after it's closed. wontfix 47.
https://hg.mozilla.org/integration/mozilla-inbound/rev/a97ebab940c6ba0f19348c38d17a2193ee75c9ab
Bug 1242662 - Don't emit opening paren for decompiled bound function. r=jandem
https://hg.mozilla.org/mozilla-central/rev/a97ebab940c6
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
(In reply to Johnny Stenback  (:jst, jst@mozilla.com) from comment #4)
> Till, is this one ready to land?

Sorry, I somehow overlooked this :(
Flags: needinfo?(till)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: