Closed Bug 686305 Opened 15 years ago Closed 14 years ago

Reflect.parse(""+a+b) has wrong precedence

Categories

(Core :: JavaScript Engine, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 630213

People

(Reporter: benjamin.lerner, Unassigned)

Details

(Whiteboard: js-triage-needed)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2 Build ID: 20110902133214 Steps to reproduce: For the JS script var a=1,b=2; ""+a+b Using Reflect.parse (in js 1.8.5*) yields the AST ("" + (a+b)), rather than the correct ((""+a) + b). Specifically, it returns a structure (with locations elided for simplicity) { type: "ExpressionStatement", expression: { type: "BinaryExpression", operator: "+", left: { type: "Literal", value: "" } right: { type: "BinaryExpression", operator: "+", left: { type: "Identifier", name: "a" }, right: { type: "Identifier", name: "b" } } } } Oddly, actually *running* the expression ""+a+b in Firefox yields the expected "12" as the answer, rather than "3" as this AST would indicate. * We're pretty sure we're running js 1.8.5; it came from the 1.8.5 source release, but js -version reads "JavaScript-C 1.8.0 pre-release 1 2007-10-03", and then goes on to indicate that it has -v 185 support (by default) for js 1.8.5. At least one part of this message is confusing...
Whiteboard: js-triage-needed
This works for me on dca24d75d9cc: { type:"ExpressionStatement", expression: { type:"BinaryExpression", operator:"+", left: { type:"BinaryExpression", operator:"+", left: { type:"Literal", value:"" }, right: { type:"Identifier", name:"a" } }, right: { type:"Identifier", name:"b" } } }
I think this bug might be a dup of bug 630213, which is already fixed. WFM in recent builds of the SpiderMonkey shell: js> (Reflect.parse('var a=1,b=2;\n""+a+b', {loc:false})).body[1].expression.left ({loc:null, type:"BinaryExpression", operator:"+", left:{loc:null, type:"Literal", value:""}, right:{loc:null, type:"Identifier", name:"a"}}) I tried this in the jsshell available from http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/ and it worked, too. Ben, how old is the binary you're running? I'm afraid 1.8.5 isn't really a version of the software, it's just an informal version for the language. Dave
I don't know, exactly :( Quite possibly, November 2010. I'd filed this bug on behalf of a friend, who's been working mostly in Linux, and since I'm on windows I went looking for the most recent pre-built windows binary I could find. (I didn't have a mozilla build environment handy, so pre-built was a must.) Is there a command-line option to give the build date in addition to the version? (If there isn't, could there please be? :-p) Incidentally, I can't get the win32 or win64 binaries to run; they claim "the program can't start because mozutils.dll is missing from [my] computer. try reinstalling the program to fix this problem.". What am I missing, and where can I find mozutils.dll?
(In reply to Ben Lerner from comment #3) > Incidentally, I can't get the win32 or win64 binaries to run; they claim > "the program can't start because mozutils.dll is missing from [my] computer. > try reinstalling the program to fix this problem.". What am I missing, and > where can I find mozutils.dll? Could you file a separate bug for this, and cite this comment? (Bugzilla will automatically cite if you make it of the form "bug 686305 comment 3".) Probably filing against the build system will yield the best results, those guys know everything! :-)
Done - bug 691876. I think I targeted the right build system folks; if not, feel free to correct it :)
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.