AS3 preincrement fix

use same local register names fix
This commit is contained in:
Jindra Petřík
2015-04-06 21:37:43 +02:00
parent acbf5647cb
commit 72d00b501b
4 changed files with 5 additions and 4 deletions

View File

@@ -1499,7 +1499,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if ((round == 1) && (m.matches())) {
String regIndexStr = m.group(1);
int regIndex = Integer.parseInt(regIndexStr);
while (registerNames.size() <= regIndex) {
while (registerNames.size() <= regIndex + 1) {
String standardName = String.format(mask, registerNames.size() - 1);
registerNames.add(standardName);
registerTypes.add("*");

View File

@@ -2181,7 +2181,7 @@ public class ActionScriptParser {
break;
case INCREMENT:
case DECREMENT: //preincrement
GraphTargetItem varincdec = expression(thisType, pkg, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, false/*?*/, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables);
GraphTargetItem varincdec = expressionPrimary(thisType, pkg, needsActivation, importedClasses, openedNamespaces, false, registerVars, inFunction, inMethod, false/*?*/, variables);//name(thisType,false, openedNamespaces, registerVars, inFunction, inMethod, variables);
if (!isNameOrProp(varincdec)) {
throw new AVM2ParseException("Not a property or name", lexer.yyline());
}

View File

@@ -343,11 +343,12 @@ public class NameAVM2Item extends AssignableAVM2Item {
//Start get original
generateGetLoc(regNumber), generateGetSlot(slotScope, slotNumber),
//End get original
!isInteger ? ins(new ConvertDIns()) : null,
//!isInteger ? ins(new ConvertDIns()) : null,
//End get original
(!post) ? (decrement ? ins(isInteger ? new DecrementIIns() : new DecrementIns()) : ins(isInteger ? new IncrementIIns() : new IncrementIns())) : null,
needsReturn ? ins(new DupIns()) : null,
(post) ? (decrement ? ins(isInteger ? new DecrementIIns() : new DecrementIns()) : ins(isInteger ? new IncrementIIns() : new IncrementIns())) : null,
generateCoerce(localData, generator, returnType()),
generateSetLoc(regNumber),
slotNumber > -1 ? ins(new SetSlotIns(), slotNumber) : null
);