AS3 hasnext/nextname fixes

No visited warnings
This commit is contained in:
Jindra Petřík
2015-07-05 18:16:06 +02:00
parent 67e8882e6c
commit ebc00c6656
4 changed files with 26 additions and 11 deletions
@@ -1439,7 +1439,7 @@ public class AVM2Code implements Cloneable {
throw new UnknownJumpException(stack, ip, output);
}
if (visited[ip]) {
logger.warning("Code already visited, ofs:" + Helper.formatAddress(pos2adr(ip)) + ", ip:" + ip);
//logger.warning(path + ": Code already visited, ofs:" + Helper.formatAddress(pos2adr(ip)) + ", ip:" + ip);
break;
}
visited[ip] = true;
@@ -1548,11 +1548,14 @@ public class AVM2Code implements Cloneable {
if (code.get(t + 1).definition instanceof KillIns) {
if (code.get(t + 1).operands[0] == reg) {
ConvertOutput assignment = toSourceOutput(path, part, processJumps, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, ip + 2, t - 1, localRegNames, fullyQualifiedNames, visited, localRegAssigmentIps, refs);
GraphTargetItem tar = assignment.output.remove(assignment.output.size() - 1);
tar.firstPart = part;
stack.push(tar);
ip = t + 2;
continue iploop;
if (!assignment.output.isEmpty()) {
GraphTargetItem tar = assignment.output.remove(assignment.output.size() - 1);
tar.firstPart = part;
stack.push(tar);
ip = t + 2;
continue iploop;
}
}
}
}
@@ -40,9 +40,21 @@ public class HasNextAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
collection.appendTo(writer, localData);
writer.append(" hasNext ");
return object.appendTo(writer, localData);
writer.append("§§hasnext(");
if (collection != null) {
collection.appendTo(writer, localData);
} else {
writer.append("null");
}
writer.append(",");
if (object != null) {
object.appendTo(writer, localData);
} else {
writer.append("null");
}
writer.append(")");
return writer;
}
@Override
@@ -40,7 +40,7 @@ public class NextNameAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append("nextName");
writer.append("§§nextname");
writer.spaceBeforeCallParenthesies(2);
writer.append("(");
index.toString(writer, localData);
@@ -40,7 +40,7 @@ public class NextValueAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append("nextValue");
writer.append("§§nextvalue");
writer.spaceBeforeCallParenthesies(2);
writer.append("(");
index.toString(writer, localData);