Consolidate actionscript import munging, add Map conversion.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6674 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2011-07-06 17:55:20 +00:00
parent 455eb55d90
commit 23614ac71f
4 changed files with 51 additions and 62 deletions
@@ -223,6 +223,36 @@ public class ActionScriptUtils
}
}
/**
* Converts java types to their actionscript equivalents for ooo-style streaming.
*/
public static void convertBaseClasses (ImportSet imports)
{
// replace primitive types with OOO types (required for unboxing)
imports.replace("byte", "com.threerings.util.Byte");
imports.replace("int", "com.threerings.util.Integer");
imports.replace("boolean", "com.threerings.util.langBoolean");
imports.replace("[B", "flash.utils.ByteArray");
imports.replace("float", "com.threerings.util.Float");
imports.replace("long", "com.threerings.util.Long");
if (imports.removeAll("[*") > 0) {
imports.add("com.threerings.io.TypedArray");
}
// convert java primitive boxes to their ooo counterparts
imports.replace(Integer.class, "com.threerings.util.Integer");
// convert some java.util types to their ooo counterparts
imports.replace(Map.class, "com.threerings.util.Map");
// get rid of java.lang stuff and any remaining primitives
imports.removeGlobals();
// get rid of remaining arrays
imports.removeArrays();
}
public static File createActionScriptPath (File actionScriptRoot, Class<?> sclass)
{
// determine the path to the corresponding action script source file