Heavy constructor JIT optimisation in ActionScript

I was running FlexPMD the other day over some code and it brought up this warning: "HeavyConstructor. Constructor must be as lightweight as possible. No control statement allowed, whereas a cyclomatic complexity of 2 has been detected. The Just-In-Time compiler does not compile constructors. Make them as lightweight as possible, or move the complexity of the code to a method called by the constructor. Then the complexity will be compiled by the JIT."

Huh? That's news to me, actionscript constructors are not compiled if they have a conditional statement in them?


Refactoring Binary Type ActionScript Classes

A little while ago I wrote some type safe binary classes Byte and Word for a CPU emulator I'm working on. The classes worked correctly and were good fit for what I needed but something bothered me about them. The Word and Byte classes had a lot of common code. This was not really a surprise because I first wrote the Byte class than did copy and pasted and made a few changes here and there to make the Word class. For just these two class that's probably OK, but I now needed a third class (a Nibble or 1/2 a Byte) so it was time to refactor.


Bit and Byte classes in ActionScript

One of the features of ActionScript (good or bad depending on your point of view) is that it only has a few built in primitive types namely int, unit, Number and Boolean. Unlike other languages there's no long or byte type. I'm current working on a project that involves a lot of mucking about with bits and bytes and I thought I'd share the code.