Merge fix

AS3 constantpool getXXXId "add" parameter now required to avoid acidentally forgetting it
This commit is contained in:
Jindra Petřík
2015-11-08 12:35:56 +01:00
parent bc7d05056c
commit a5d4f7d5b6
5 changed files with 14 additions and 15 deletions

View File

@@ -253,7 +253,7 @@ public class AVM2ConstantPool implements Cloneable {
return index;
}
public int getNamespaceId(int kind, int nameIndex, int index) {
private int getNamespaceId(int kind, int nameIndex, int index) {
for (int n = 1; n < constant_namespace.size(); n++) {
Namespace ns = constant_namespace.get(n);
if (ns.name_index == nameIndex && (ns.kind == kind)) {
@@ -292,7 +292,7 @@ public class AVM2ConstantPool implements Cloneable {
return getNamespaceId(kind, nameIndex, index, add);
}
public int getIntId(long value) {
private int getIntId(long value) {
for (int i = 1; i < constant_int.size(); i++) {
if (constant_int.get(i) == value) {
return i;
@@ -301,7 +301,7 @@ public class AVM2ConstantPool implements Cloneable {
return -1;
}
public int getUIntId(long value) {
private int getUIntId(long value) {
for (int i = 1; i < constant_uint.size(); i++) {
if (constant_uint.get(i) == value) {
return i;
@@ -310,7 +310,7 @@ public class AVM2ConstantPool implements Cloneable {
return -1;
}
public int getDoubleId(double value) {
private int getDoubleId(double value) {
for (int i = 1; i < constant_double.size(); i++) {
if (Double.isNaN(value) && Double.isNaN(constant_double.get(i))) {
return i;
@@ -322,7 +322,7 @@ public class AVM2ConstantPool implements Cloneable {
return -1;
}
public int getStringId(String val) {
private int getStringId(String val) {
if (val == null) {
return 0;
}
@@ -334,7 +334,7 @@ public class AVM2ConstantPool implements Cloneable {
return -1;
}
public int getMultinameId(Multiname val) {
private int getMultinameId(Multiname val) {
loopm:
for (int m = 1; m < constant_multiname.size(); m++) {
Multiname mul = constant_multiname.get(m);
@@ -393,7 +393,7 @@ public class AVM2ConstantPool implements Cloneable {
return id;
}
public int getNamespaceSetId(NamespaceSet val) {
private int getNamespaceSetId(NamespaceSet val) {
loopi:
for (int i = 1; i < constant_namespace_set.size(); i++) {
NamespaceSet ts = constant_namespace_set.get(i);

View File

@@ -757,7 +757,7 @@ public class ASM3Parser {
operandsList.add(0);
} else {
if (parsedOperand.type == ParsedSymbol.TYPE_STRING) {
int sid = constants.getStringId((String) parsedOperand.value);
int sid = constants.getStringId((String) parsedOperand.value, false);
if (sid == -1) {
if ((missingHandler != null) && (missingHandler.missingString((String) parsedOperand.value))) {
sid = constants.addString((String) parsedOperand.value);
@@ -778,7 +778,7 @@ public class ASM3Parser {
} else {
if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) {
long intVal = (Long) parsedOperand.value;
int iid = constants.getIntId(intVal);
int iid = constants.getIntId(intVal, false);
if (iid == -1) {
if ((missingHandler != null) && (missingHandler.missingInt(intVal))) {
iid = constants.addInt(intVal);
@@ -798,7 +798,7 @@ public class ASM3Parser {
} else {
if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) {
long intVal = (Long) parsedOperand.value;
int iid = constants.getUIntId(intVal);
int iid = constants.getUIntId(intVal, false);
if (iid == -1) {
if ((missingHandler != null) && (missingHandler.missingUInt(intVal))) {
iid = constants.addUInt(intVal);
@@ -825,7 +825,7 @@ public class ASM3Parser {
if (parsedOperand.type == ParsedSymbol.TYPE_FLOAT) {
doubleVal = (Double) parsedOperand.value;
}
int did = constants.getDoubleId(doubleVal);
int did = constants.getDoubleId(doubleVal, false);
if (did == -1) {
if ((missingHandler != null) && (missingHandler.missingDouble(doubleVal))) {
did = constants.addDouble(doubleVal);

View File

@@ -2179,8 +2179,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
new Multiname(origM.kind,
abcIndex.getSelectedAbc().constants.getStringId(ci.abc.constants.getString(origM.name_index), true),
abcIndex.getSelectedAbc().constants.getNamespaceId(origNs.kind,
ci.abc.constants.getString(origNs.name_index), 0, true), 0, 0, new ArrayList<>())
));
ci.abc.constants.getString(origNs.name_index), 0, true), 0, 0, new ArrayList<>()), true));
}
//add all parent objects to scopestack

View File

@@ -984,7 +984,7 @@ public class ActionScript3Parser {
publicNs = gpublicNs;
}
openedNamespaces.add(privateNs = abcIndex.getSelectedAbc().constants.addNamespace(new Namespace(Namespace.KIND_PRIVATE, abcIndex.getSelectedAbc().constants.getStringId(pkg.toRawString() + ":" + nameStr))));
openedNamespaces.add(privateNs = abcIndex.getSelectedAbc().constants.addNamespace(new Namespace(Namespace.KIND_PRIVATE, abcIndex.getSelectedAbc().constants.getStringId(pkg.toRawString() + ":" + nameStr, true))));
openedNamespaces.add(abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_NAMESPACE, AS3_NAMESPACE, 0, true));

View File

@@ -115,7 +115,7 @@ public class Namespace {
}
public DottedChain getName(AVM2ConstantPool constants) {
if (name_index == 0) {
if (name_index == 0 || name_index == -1) {
return DottedChain.EMPTY;
}