Closed Bug 352202 Opened 18 years ago Closed 18 years ago

Decompilation of "for ((~x)["y"] in z)" does not compile

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1

People

(Reporter: jruderman, Assigned: brendan)

Details

(Keywords: testcase, verified1.8.1)

Attachments

(1 file)

js> function() { for ((~x)["y"] in z) { } } 

function () {
    for (~x["y"] in z) {
    }
}

js> function () {
    for (~x["y"] in z) {

typein:5: SyntaxError: invalid for/in left-hand side:

I don't know whether the bug is 
(1) the decomiler omitting parens or 
(2) the compiler rejecting the second line.
(In reply to comment #0)
> js> function() { for ((~x)["y"] in z) { } } 
> 
> function () {
>     for (~x["y"] in z) {
>     }
> }
> 
> js> function () {
>     for (~x["y"] in z) {
> 
> typein:5: SyntaxError: invalid for/in left-hand side:
> 
> I don't know whether the bug is 
> (1) the decomiler omitting parens or 

Of course it's (1).

> (2) the compiler rejecting the second line.

For any expression E, ~E is not a left-hand side expression.

/be
OS: Mac OS X 10.4 → All
Hardware: Macintosh → All
Attached patch fixSplinter Review
JSOP_ENUMELEM and JSOP_SETELEM both had this bug.  Fix requires setting op to JSOP_GETELEM before popping lval.  Irreducible complexity, in the current design of the decompiler.

/be
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #237799 - Flags: review?(mrbkap)
Priority: -- → P1
Target Milestone: --- → mozilla1.8.1
Attachment #237799 - Flags: review?(mrbkap) → review+
Attachment #237799 - Flags: approval1.8.1?
Fixed on trunk.

/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Checking in jsopcode.c;
/cvsroot/mozilla/js/src/jsopcode.c,v  <--  jsopcode.c
new revision: 3.170; previous revision: 3.169
done
Comment on attachment 237799 [details] [diff] [review]
fix


a=schrep
Attachment #237799 - Flags: approval1.8.1? → approval1.8.1+
Fixed on the 1.8 branch.

/be
Keywords: fixed1.8.1
Checking in regress-352202.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-352202.js,v  <--  regress-352202.js
initial revision: 1.1
done
Flags: in-testsuite+
verified fixed 1.8 20060914 windows/linux 1.9 20060914 windows/mac*/linux
Status: RESOLVED → VERIFIED
Checking in regress-352202.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-352202.js,v  <--  regress-352202.js
new revision: 1.2; previous revision: 1.1
done
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: