Running toSource on parsed hexadecimal gives wrong result

UNCONFIRMED
Unassigned

Status

UNCONFIRMED
9 years ago
7 years ago

People

(Reporter: frankgroeneveld, Unassigned)

Tracking

Details

Attachments

(2 attachments)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
Build Identifier: Source from CVS trunk @ 20091113

Parsing this code:
seed = (typeof fixedseed == "number") ? fixedseed : (Math.round(Math.random() * 0xffffffff));

and running to source on the ASt that is produced, will result in something like this:
seed = (typeof fixedseed == "number") ? fixedseed : (Math.round(Math.random() * ffffffff));

Note that the 0x part of 0xffffffff is stripped off.


Reproducible: Always
(Reporter)

Comment 1

9 years ago
Happens with trunk also.
(Reporter)

Comment 2

9 years ago
Created attachment 426670 [details] [diff] [review]
Patch to fix this bug

Fix this bug.

Comment 3

7 years ago
Created attachment 599577 [details] [diff] [review]
Patch for parsing hexadecimal numbers

Patch for parsing hexadecimal numbers.
Try running the following before and after the patch:

new Parser().parse("var color = 0xAABBCC;", "", 1).toSource();
You need to log in before you can comment on or make changes to this bug.