[Laszlo-dev] something in LzFormatter.formatToString is causing the flex compiler to emit bad code

P T Withington ptw at pobox.com
Fri Mar 7 12:37:41 PST 2008


How strange.  Clearly they forgot that you could 'fall through' to the  
end of the switch.  We could work around this in our compiler, if they  
have not fixed it...  You'll file a bug with them?

On 2008-03-06, at 16:53 EST, Henry Minsky wrote:

> When I add a break statement as the last line, it fixes it. I guess  
> I ought
> to report this as a bug to adobe...
>
>        switch (directive) {
>          case 'U':
>          case 'O':
>          case 'X':
>          case 'u':
>          case 'o':
>          case 'x':
>          if (value < 0) {
>            value = (- value);
>            var wid = Math.abs(parseInt(length));
>            if (isNaN(wid)) {
>              wid = Number(value).toString(radix).length;
>            }
>            var max = Math.pow(radix, wid);
>            value = max - value;
>          }
>          break;
>      }
>
>
> On Thu, Mar 6, 2008 at 4:22 PM, Henry Minsky  
> <henry.minsky at gmail.com> wrote:
>
>> When I comment out this code block, I don't get the verifier error
>>
>>        switch (directive) {
>>        case 'U': case 'O': case 'X':
>>        case 'u': case 'o': case 'x':
>>          if (value < 0) {
>>            value = (- value);
>>            // NOTE: [2006-11-17 ptw] Number('') -> NaN in swf, 0 in
>>            // ECMA, hence use parseInt
>>            var wid = Math.abs(parseInt(length));
>>            if (isNaN(wid)) {
>>              wid = Number(value).toString(radix).length;
>>            }
>>            var max = Math.pow(radix, wid);
>>            value = max - value;
>>          }
>>      }
>>
>> mysterious...
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Mar 6, 2008 at 3:55 PM, Henry Minsky <henry.minsky at gmail.com>
>> wrote:
>>
>>> I'm trying to compile the LzFormatter mixin with LzText in swf9,  
>>> and am
>>> encountering some runtime error,
>>> the flash runtime gives a verifier error of some sort. I'm trying to
>>> carve down the formatToString method
>>> to locate which statement is causing trouble. It doesn't seem to  
>>> be the
>>> inner function, which I suspected
>>> because we saw an earlier problem with non-global functions which  
>>> were
>>> assigned names. But our
>>> compiler isn't giving the local function a function name, and  
>>> moving it
>>> out to be a class method doesn't make
>>> any difference. So I'm just doing a binary search on the method  
>>> body to
>>> figure out what the offending code is....
>>>
>>>
>>>
>>> --
>>> Henry Minsky
>>> Software Architect
>>> hminsky at laszlosystems.com
>>>
>>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com
>>
>>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list