When generating ActionScript streamable classes, use TypedArray for fields but

Array for static constants and method arguments.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4403 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-10-04 21:08:12 +00:00
parent f4a25e9521
commit 874d8eaa8f
@@ -160,7 +160,8 @@ public class ActionScriptSource
builder.append(field.getName()).append(" :"); builder.append(field.getName()).append(" :");
// now convert the type to an ActionScript type // now convert the type to an ActionScript type
builder.append(toActionScriptType(field.getType())); builder.append(toActionScriptType(field.getType(),
!Modifier.isStatic(mods)));
builder.append(";"); builder.append(";");
@@ -195,7 +196,7 @@ public class ActionScriptSource
builder.append(", "); builder.append(", ");
} }
builder.append("arg").append(idx); builder.append("arg").append(idx);
builder.append(" :").append(toActionScriptType(ptype)); builder.append(" :").append(toActionScriptType(ptype, false));
if (needsNoArg) { if (needsNoArg) {
builder.append(" = undef"); builder.append(" = undef");
} }
@@ -237,19 +238,19 @@ public class ActionScriptSource
builder.append(", "); builder.append(", ");
} }
builder.append("arg").append(idx); builder.append("arg").append(idx);
builder.append(" :").append(toActionScriptType(ptype)); builder.append(" :").append(toActionScriptType(ptype, false));
} }
builder.append(") :"); builder.append(") :");
builder.append(toActionScriptType(method.getReturnType())); builder.append(toActionScriptType(method.getReturnType(), false));
return builder.toString(); return builder.toString();
} }
public static String toActionScriptType (Class type) public static String toActionScriptType (Class type, boolean isField)
{ {
if (type.isArray()) { if (type.isArray()) {
return "TypedArray"; return isField ? "TypedArray" : "Array";
} }
String tname = type.getName(); String tname = type.getName();