Made actionscript code generation ByteArray-aware.

(ByteArray is a special class for dealing with bytes. It does not extend
the normal Array).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4452 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-11-15 02:53:12 +00:00
parent 253d8ae90c
commit 2ad124322d
7 changed files with 16 additions and 1 deletions
@@ -265,6 +265,9 @@ public class ActionScriptSource
public static String toActionScriptType (Class type, boolean isField)
{
if (type.isArray()) {
if (Byte.TYPE.equals(type.getComponentType())) {
return "ByteArray";
}
return isField ? "TypedArray" : "Array";
}
@@ -296,7 +296,12 @@ public class GenActionScriptTask extends Task
return "new Long(ins.readInt(), ins.readInt())";
} else if (type.isArray()) {
return "(ins.readObject() as TypedArray)";
if (Byte.TYPE.equals(type.getComponentType())) {
return "(ins.readObject() as ByteArray)";
} else {
return "(ins.readObject() as TypedArray)";
}
} else {
return "(ins.readObject() as " +
@@ -109,6 +109,9 @@ public class GenUtil
public static String simpleASName (Class<?> clazz)
{
if (clazz.isArray()) {
if (Byte.TYPE.equals(clazz.getComponentType())) {
return "ByteArray";
}
return "Array";
} else if (clazz == Boolean.TYPE) {
return "Boolean";
@@ -1,5 +1,6 @@
package $package {
import flash.utils.ByteArray;
import com.threerings.util.*; // for Float, Integer, etc.
#foreach ($import in $imports)
@@ -1,5 +1,6 @@
package $package {
import flash.utils.ByteArray;
import com.threerings.util.*; // for Float, Integer, etc.
#foreach ($import in $imports)
@@ -1,5 +1,6 @@
package $package {
import flash.utils.ByteArray;
#foreach ($import in $imports)
import $import;
#end
@@ -1,5 +1,6 @@
package $package {
import flash.utils.ByteArray;
import com.threerings.util.*; // for Float, Integer, etc.
#foreach ($import in $imports)