Closed Bug 346898 Opened 18 years ago Closed 18 years ago

Expressions optimized into strings uneval using double-quotes, causing change to single-quotes during round trip

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: testcase)

http://www.squarefree.com/shell/shell.html, Mac trunk nightly.

When round-tripped through the JavaScript engine using uneval and eval, this function is changed from using double quotes to using single quotes.

> function() { [3]["" + ""] }
function () { [3][""]; }

> function() { [3][""] }
function () { [3]['']; }

Here's another example, this time using a different optimization, where it changes from using double quotes to using dot notation:

> function() { [3][0 ? "a" : "b"] }
function () { [3]["b"]; }

> function () { [3]["b"]; }
function () { [3].b; }
This is all allowed by ECMA, and we want to optimize.  So until we switch to source recovery from decompilation, you'll have to round-trip once to bless the function to match its canonical source.  I'm gonna WONTFIX, since this is not exactly INVALID.  With more source annotations, we could decompile what you wrote, but it's not worth it.

/be
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
I'm not asking you to "decompile what I wrote"; I'm asking you to use the same notation for optimized expressions as would be used in the same context if the expression had not needed optimization.  Feel free to wontfix again.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
(In reply to comment #2)
> I'm not asking you to "decompile what I wrote"; I'm asking you to use the same
> notation for optimized expressions as would be used in the same context if the
> expression had not needed optimization.

There's no difference in practice.  We always optimize a certain way, or we don't, so either you get what you wrote, or what we optimized.  Not sure why you are reopening just to argue.

> Feel free to wontfix again.

I will!

/be 

Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → WONTFIX
Summary: Expressions optimized into strings uneval strangely, causing function to change during round trip → Expressions optimized into strings uneval using double-quotes, causing change to single-quotes during round trip
FWIW, on the disassembly side, this WONTFIXed bug amounts to the difference between

00006:  string ""
00009:  getelem

and

00006:  getprop ""
See Also: → 1143279
You need to log in before you can comment on or make changes to this bug.