Closed Bug 352649 Opened 18 years ago Closed 18 years ago

RegExp literal after "if" block is considered a syntax error

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: testcase, verified1.8.1.1)

js> function() { if (x) { } (/a/gi.z); }
function () {
    if (x) {
    }
    /a/gi.z;
}

js> function() { if(x) { } /a/gi.z; }
syntax error

I think this is a bug in the compiler (rather than a bug in the decompiler), and the version without parens around the RegExp stuff should be accepted.
Same thing happens with E4X literals, which perhaps isn't surprising.

js> function() { if(g) p; (<x/>.i) }    
function () {
    if (g) {
        p;
    }
    <x/>.i;
}

js> function () {
    if (g) {
        p;
    }
    <x/>.i;
typein:18: SyntaxError: syntax error:
Fixed by "prep patch for plan A" in bug 346642.
Depends on: desdec
Fixed on trunk because "prep patch for plan A, v9d" in bug 346642 was checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Checking in e4x/Regress/regress-352649.js;
/cvsroot/mozilla/js/tests/e4x/Regress/regress-352649.js,v  <--  regress-352649.js
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/js/tests/js1_5/Regress/regress-352649.js,v
done
Checking in js1_5/Regress/regress-352649.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-352649.js,v  <--  regress-352649.js
initial revision: 1.1
done
Flags: in-testsuite+
I am not sure the test is adequate as it does not fail on 1.8. Was this a trunk only regression?

verified fixed 1.9 20060919 windows/mac*/linux
Status: RESOLVED → VERIFIED
fixed by bug 346642 
verified fixed 20061203 windows/linux/mac*
Keywords: verified1.8.1.1
You need to log in before you can comment on or make changes to this bug.