Closed Bug 356106 Opened 18 years ago Closed 18 years ago

Assertion failure: rval[strlen(rval)-1] == '}'

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: crash, testcase)

Attachments

(1 file)

js> function() { return ({x setter: function(){} | 5 }) } Assertion failure: rval[strlen(rval)-1] == '}', at jsopcode.c:3875
Status: NEW → ASSIGNED
OS: Mac OS X 10.4 → All
Hardware: Macintosh → All
Assignee: general → crowder
Status: ASSIGNED → NEW
What is the expected result?
Status: NEW → ASSIGNED
The value of that setter is not a function, it's a string. Debug to see what rval contains. /be
So this is another case that must fall back on the old setter: syntax. IOW, as with the first LOCAL_ASSERT, transform into an if that tests opposite of the asserted condition. /be
I also cleaned up some logic that is unnecessary (pasted from above and added in my last patch in this area without noticing the redundancy). I'll rip it out, if it's bad form to piggyback.
Attachment #241808 - Flags: review?(brendan)
I don't think converting the assertion to an if creates the correct test. Consider: ({x setter: function(){} | function(){} })
I get an invalid setter usage error for that case, which seems fine?
You'd get "invalid setter usage" for the stuff in comment 0 too if you try to evaluate the object naked. That's why it's wearing a function.
This decompilation seems okay, though. No meaning is lost and the code is still broken in the same way as it was before. js> function() { return ({x setter: function(){} | function(){} }) } function () { return {set x() {} | function () {}}; }
(In reply to comment #8) > This decompilation seems okay, though. No meaning is lost and the code > is still broken in the same way as it was before. > > js> function() { return ({x setter: function(){} | function(){} }) } > function () { > return {set x() {} | function () {}}; > } No, that's a syntax error whereas the old syntax is a runtime error. Different meaning. See comment 3, use the old syntax here. /be
So I should look for the first { of the function match/count braces to the end, and if there is anything after the last }, I should use old getter/setter output?
Talking to crowder on IRC, thinking for three seconds in a row about this (:-), I think we should make non-function-expression initialisers for old-style getter: and setter: property initialisers be syntax errors. /be
Comment on attachment 241808 [details] [diff] [review] another old-school getter/setter decompilation case - for now in light of new thinking. Hope we can get away with this incompatible change. It's not just making a runtime error be a syntax error -- up till now you could write o = {p getter: f} where f was a function declared previously. Not sure how to keep that working and make decompilation simple. Also not sure we want this incompatibility in js1.7src/1.8.1.1 -- by default, we should *not* make so incompatible (albeit to non-standard API) a change. /be
Attachment #241808 - Flags: review?(brendan) → review-
Is this really a critical bug?
I think this one is beyond my feeble knowledge of the parser, hoping someone else will pick up.
Assignee: crowder → general
Status: ASSIGNED → NEW
This bug has either morphed or been fixed: js> function() { return ({x setter: function(){} | 5 }) } function () { return {x setter: function () {} | 5}; }
What do you mean by "morphed"? That looks fine to me. This bug was probably fixed in one of the many other getter/setter decompilation bugs (bug 381101, bug 356083, etc).
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
Is the loss of parenthesis an issue here?
The parens around the entire object literal? Those aren't needed because after "return", a "{" opens an object literal rather than a code block.
Flags: in-testsuite?
/cvsroot/mozilla/js/tests/js1_5/extensions/regress-356106.js,v <-- regress-356106.js initial revision: 1.1
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: