Turn protected Java members into protected ActionScript members, and put them in the right place in the file.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6381 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -34,6 +34,7 @@ import org.apache.tools.ant.Project;
|
|||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
@@ -91,9 +92,18 @@ public class GenActionScriptStreamableTask extends GenTask
|
|||||||
for (Class<?> iface : sclass.getInterfaces()) {
|
for (Class<?> iface : sclass.getInterfaces()) {
|
||||||
implemented.add(ActionScriptUtils.addImportAndGetShortType(iface, false, imports));
|
implemented.add(ActionScriptUtils.addImportAndGetShortType(iface, false, imports));
|
||||||
}
|
}
|
||||||
List<ASField> fields = Lists.newArrayList();
|
List<ASField> pubFields = Lists.newArrayList();
|
||||||
|
List<ASField> protFields = Lists.newArrayList();
|
||||||
for (Field f : reqs.streamedFields) {
|
for (Field f : reqs.streamedFields) {
|
||||||
fields.add(new ASField(f, imports));
|
int mods = f.getModifiers();
|
||||||
|
if (Modifier.isPublic(mods)) {
|
||||||
|
pubFields.add(new ASField(f, imports));
|
||||||
|
} else if (Modifier.isProtected(mods)) {
|
||||||
|
protFields.add(new ASField(f, imports));
|
||||||
|
} else {
|
||||||
|
// don't care about private
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String output = mergeTemplate("com/threerings/presents/tools/streamable_as.tmpl",
|
String output = mergeTemplate("com/threerings/presents/tools/streamable_as.tmpl",
|
||||||
@@ -104,7 +114,8 @@ public class GenActionScriptStreamableTask extends GenTask
|
|||||||
"extends", extendsName,
|
"extends", extendsName,
|
||||||
"implements", Joiner.on(", ").join(implemented),
|
"implements", Joiner.on(", ").join(implemented),
|
||||||
"superclassStreamable", reqs.superclassStreamable,
|
"superclassStreamable", reqs.superclassStreamable,
|
||||||
"fields", fields,
|
"pubFields", pubFields,
|
||||||
|
"protFields", protFields,
|
||||||
"dobject", isDObject);
|
"dobject", isDObject);
|
||||||
|
|
||||||
File outputLocation = ActionScriptUtils.createActionScriptPath(_asroot, sclass);
|
File outputLocation = ActionScriptUtils.createActionScriptPath(_asroot, sclass);
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ public class {{classname}} {{^extends.isEmpty}}extends {{extends}}
|
|||||||
// GENERATED CLASSDECL END
|
// GENERATED CLASSDECL END
|
||||||
|
|
||||||
// GENERATED STREAMING START
|
// GENERATED STREAMING START
|
||||||
{{#fields}}
|
{{#pubFields}}
|
||||||
public var {{name}} :{{simpleType}};
|
public var {{name}} :{{simpleType}};
|
||||||
|
|
||||||
{{/fields}}
|
{{/pubFields}}
|
||||||
{{#dobject}}
|
{{#dobject}}
|
||||||
{{#fields}}
|
{{#pubFields}}
|
||||||
public var set{{capitalName}} :Signal = new Signal({{simpleType}}, {{simpleType}});
|
public var set{{capitalName}} :Signal = new Signal({{simpleType}}, {{simpleType}});
|
||||||
{{#dset}}
|
{{#dset}}
|
||||||
public var addedTo{{capitalName}} :Signal = new Signal(DSet_Entry);
|
public var addedTo{{capitalName}} :Signal = new Signal(DSet_Entry);
|
||||||
@@ -31,21 +31,24 @@ public class {{classname}} {{^extends.isEmpty}}extends {{extends}}
|
|||||||
{{#array}}
|
{{#array}}
|
||||||
public var updated{{capitalName}} :Signal = new Signal(int, Object, Object);
|
public var updated{{capitalName}} :Signal = new Signal(int, Object, Object);
|
||||||
{{/array}}
|
{{/array}}
|
||||||
{{/fields}}
|
{{/pubFields}}
|
||||||
|
|
||||||
{{#fields}}
|
{{#pubFields}}
|
||||||
public static const {{dobjectField}} :String = "{{name}}";
|
public static const {{dobjectField}} :String = "{{name}}";
|
||||||
|
|
||||||
{{/fields}}
|
{{/pubFields}}
|
||||||
{{/dobject}}
|
{{/dobject}}
|
||||||
{{#superclassStreamable}}override {{/superclassStreamable}}public function readObject (ins :ObjectInputStream) :void
|
{{#superclassStreamable}}override {{/superclassStreamable}}public function readObject (ins :ObjectInputStream) :void
|
||||||
{
|
{
|
||||||
{{#superclassStreamable}}
|
{{#superclassStreamable}}
|
||||||
super.readObject(ins);
|
super.readObject(ins);
|
||||||
{{/superclassStreamable}}
|
{{/superclassStreamable}}
|
||||||
{{#fields}}
|
{{#pubFields}}
|
||||||
{{name}} = ins.{{reader}};
|
{{name}} = ins.{{reader}};
|
||||||
{{/fields}}
|
{{/pubFields}}
|
||||||
|
{{#protFields}}
|
||||||
|
{{name}} = ins.{{reader}};
|
||||||
|
{{/protFields}}
|
||||||
}
|
}
|
||||||
{{^dobject}}
|
{{^dobject}}
|
||||||
|
|
||||||
@@ -54,9 +57,12 @@ public class {{classname}} {{^extends.isEmpty}}extends {{extends}}
|
|||||||
{{#superclassStreamable}}
|
{{#superclassStreamable}}
|
||||||
super.writeObject(out);
|
super.writeObject(out);
|
||||||
{{/superclassStreamable}}
|
{{/superclassStreamable}}
|
||||||
{{#fields}}
|
{{#pubFields}}
|
||||||
out.{{writer}};
|
out.{{writer}};
|
||||||
{{/fields}}
|
{{/pubFields}}
|
||||||
|
{{#protFields}}
|
||||||
|
out.{{writer}};
|
||||||
|
{{/protFields}}
|
||||||
}
|
}
|
||||||
{{/dobject}}
|
{{/dobject}}
|
||||||
|
|
||||||
@@ -66,6 +72,9 @@ public class {{classname}} {{^extends.isEmpty}}extends {{extends}}
|
|||||||
new Signaller(this);
|
new Signaller(this);
|
||||||
}
|
}
|
||||||
{{/dobject}}
|
{{/dobject}}
|
||||||
|
{{#protFields}}
|
||||||
|
protected var {{name}} :{{simpleType}};
|
||||||
|
{{/protFields}}
|
||||||
// GENERATED STREAMING END
|
// GENERATED STREAMING END
|
||||||
|
|
||||||
// GENERATED CLASSFINISH START
|
// GENERATED CLASSFINISH START
|
||||||
|
|||||||
Reference in New Issue
Block a user