This is an AS3 to Haxe converter that tries to be very smart and precise about rewriting code. To achieve that, it actually resembles the typical compiler a lot, so here's how it works:
This tool was developed and used by InnoGames to migrate our ActionScript 3 codebases. Feel free to ask questions, fork and contribute fixes. However, we are NOT planning to maintain and provide official support for this project.
java -jar converter.jar config.json
where config.json
is something like:
{
"src": "<as3 sources>",
"hxout": "<hx output>",
"swc": [
"playerglobal32_0.swc",
"<other swc libraries>"
]
}
The converter is written in Haxe 4 and is only one library, format
, for reading the SWC files.
To make it easy there's a Lix scope configured, so assuming you have nodejs installed, you can do:
npm i lix
npx lix download
npx haxe build.hxml
It uses the Java target (actually, even the new JVM bytecode target), because JVM has great GC and handles unoptimized functional code of this converter very well. Originally I used JS target, but node.js worked slower and eventually died on so many allocations. :)
Most of the TODO
s are actually in the code, so look there too, but still:
*=
as a single token when parsing signatures (fix a:*=b
parsing without spaces)TEHaxeRetype
s tooarr[arr.length] = value
to arr.push(value)
Object
with ASObject
and *
with ASAny
ASCompat
- rework some things as static extensions (e.g. Vector/Array compat methods)private
keywords)@haxe-type
inline
for arithmetic ops in static var inits where all operands are also static inlinepublic
from @:inject
/@:postConstruct
/@:preDestroy
as these should not really be part of public API