From: kangax on
On 2/22/10 2:49 AM, Richard Cornford wrote:
> kangax wrote:
>> On 2/21/10 10:50 AM, Richard Cornford wrote:
> <snip>
>>> function a(){
>>> return ({
>>> toString:function(){
>>> alert('a called');
>>> }
>>> })
>>> }
>>>
>>> function f(){
>>> var x = 0;
>>> a:while(!x++){
>>> while(true)
>>> break/*
>>> */a
>>> (x+1).toString();
>>> }
>>> }

[...]

>> I see that WebKit doesn't respect this,
>
> So that is Safari and Chrome getting this wrong, and IE is wrong as well.

FWIW, here's a related ticket in WebKit bug tracker, actually filed less
than a month ago: <https://bugs.webkit.org/show_bug.cgi?id=23611>

And yes, Chrome 5 is affected as well on my Mac OS X.

[...]

>> A simpler example demonstrates this clearly:
>>
>> (function(){
>> return/*
>> */1
>> })();
>>
>> returns `1`, not `undefined` as it should.
>
> Yes, the example is more complex than is necessary. I wrote it to look
> for something else; changes in meaning following from function
> de-compilation/re-compilation. I was thinking that if the de-compilation
> stripped comments there might be an example of removing a multi-line
> comment with a line terminator and falling to include the line
> terminator in the string output. Then the re-complied function would
> behave differently from the original. [...]

Ah, interesting assumption :)

[...]

--
kangax