Closed Bug 185165 Opened 22 years ago Closed 22 years ago

Decompilation of "\\" gives broken "\"

Categories

(Rhino Graveyard :: Core, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: user, Assigned: norrisboyd)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 Rhino does not decompile "\\" string literal properly. Given function f() { return "\\"; } Rhino currently produces for print(f.toString()) function f() { return "\"; } which contains broken "\" Reproducible: Always Steps to Reproduce: Run in the shell the following script: // Check that second decompilation of script gives the same string as first one. var f1 = function() { return "\\"; } var s1 = f1.toString(); var f2; eval("f2="+s1); var s2 = f2.toString(); var ok = (s1 === s2); print(ok); Actual Results: The shell signals syntax error: js: "x.js#8(eval)", line 3: uncaught JavaScript exception: SyntaxError: unterminated string literal (x.js#8(eval); line 3) js: return "\"; js: ..............^ Expected Results: The shell should print: true
The above fix also removes code to escape single quote ' as it was unreachable due to the previous if (' ' <= c && c <= '~' && c != '"') check.
I commited the fix.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Testcase added to JS testsuite: mozilla/js/tests/js1_5/Regress/regress-185165.js
Verified FIXED. Before the patch was applied, the testcase failed as Igor described. Now, the testcase passes in both the rhino and rhinoi shells -
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: