If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

compiling script with E4X qualified identifier in filtering predicate expression gives exception " Bad tree in codegen"

RESOLVED FIXED

Status

Rhino
Compiler
RESOLVED FIXED
11 years ago
6 years ago

People

(Reporter: Martin Honnen, Unassigned)

Tracking

head
x86
Windows XP

Details

(Reporter)

Description

11 years ago
Here is the E4X code I am trying to compile:

var xml = <books xmlns:data="thedatans">
        <book id="other">
                <title>The TItle</title>
                <data:id>TestId</data:id>
        </book>
</books>;

var data = new Namespace('thedatans');
xml.book.(data::id == 'TestId').title

That code runs flawlessly when interpreted in the Spidermonkey shell and in the Rhino shell (both Rhino 1.6 R2 as well as Rhino CVS head).

However when I try to compile the code using the following command:

java -cp "C:\somePath\mozilla\js\rhino\build\rhino1_6R3\js.jar";.
org.mozilla.javascript.tools.jsc.Main test2006071501.js

I get the following exception:


Exception in thread "main" java.lang.RuntimeException: Bad tree in codegen
        at org.mozilla.javascript.optimizer.Codegen.badTree(Codegen.java:1105)
        at org.mozilla.javascript.optimizer.BodyCodegen.visitIfJumpEqOp(Codegen.
java:3591)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateExpression(Codeg
en.java:2064)
        at org.mozilla.javascript.optimizer.BodyCodegen.visitDotQuery(Codegen.ja
va:3828)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateExpression(Codeg
en.java:2269)
        at org.mozilla.javascript.optimizer.BodyCodegen.visitGetProp(Codegen.jav
a:3680)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateExpression(Codeg
en.java:2070)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codege
n.java:1669)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codege
n.java:1510)
        at org.mozilla.javascript.optimizer.BodyCodegen.generateBodyCode(Codegen
.java:1181)
        at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:28
5)
        at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.j
ava:157)
        at org.mozilla.javascript.optimizer.ClassCompiler.compileToClassFiles(Cl
assCompiler.java:174)
        at org.mozilla.javascript.tools.jsc.Main.processSource(Main.java:267)
        at org.mozilla.javascript.tools.jsc.Main.main(Main.java:70)


I have only tried to compile with Rhino 1.6 R3 CVS head but the original bug reporter in the js-engine group reports that both 1.6 R2 as well as CVS head fail to compile such code.

Comment 1

6 years ago
Looks like this got fixed between 1.7R2 and 1.7R3.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.