small fixes/improvements

This commit is contained in:
honfika@gmail.com
2015-07-09 16:42:42 +02:00
parent d9e358d536
commit cc8bf6fb7a
56 changed files with 225 additions and 213 deletions

View File

@@ -39,10 +39,15 @@ public class NewObjectIns extends InstructionDefinition {
}
@Override
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
public void translate(boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, AVM2ConstantPool constants, AVM2Instruction ins, List<MethodInfo> method_info, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) throws InterruptedException {
int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<>();
List<NameValuePair> args = new ArrayList<>(argCount);
for (int a = 0; a < argCount; a++) {
if (Thread.currentThread().isInterrupted()) {
// int obfuscated method argCount can be 16M
throw new InterruptedException();
}
GraphTargetItem value = stack.pop();
GraphTargetItem name = stack.pop();
args.add(0, new NameValuePair(name, value));

View File

@@ -44,6 +44,13 @@ public abstract class AVM2Item extends GraphTargetItem {
}
}
public AVM2Item(GraphSourceItem instruction, int precedence, GraphTargetItem value) {
super(instruction, precedence, value);
if (instruction instanceof AVM2Instruction) {
this.instruction = (AVM2Instruction) instruction;
}
}
public AVM2Instruction getInstruction() {
return instruction;
}

View File

@@ -39,8 +39,7 @@ public class AlchemySignExtendAVM2Item extends AVM2Item {
private final int size;
public AlchemySignExtendAVM2Item(GraphSourceItem instruction, GraphTargetItem value, int size) {
super(instruction, PRECEDENCE_PRIMARY);
this.value = value;
super(instruction, PRECEDENCE_PRIMARY, value);
this.size = size;
}

View File

@@ -45,9 +45,8 @@ public class AlchemyStoreAVM2Item extends AVM2Item {
private final GraphTargetItem ofs;
public AlchemyStoreAVM2Item(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem ofs, char type, int size) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
this.ofs = ofs;
this.value = value;
this.type = type;
this.size = size;
}

View File

@@ -50,8 +50,7 @@ public class CoerceAVM2Item extends AVM2Item {
this.type = type;
}*/
public CoerceAVM2Item(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem typeObj) {
super(instruction, value.getPrecedence());
this.value = value;
super(instruction, value.getPrecedence(), value);
this.typeObj = typeObj;
}

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -29,8 +29,7 @@ public class ConvertAVM2Item extends AVM2Item {
public GraphTargetItem type;
public ConvertAVM2Item(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem type) {
super(instruction, NOPRECEDENCE);
this.value = value;
super(instruction, NOPRECEDENCE, value);
this.type = type;
}

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -26,8 +27,7 @@ import java.util.Set;
public class DecrementAVM2Item extends AVM2Item {
public DecrementAVM2Item(AVM2Instruction instruction, GraphTargetItem object) {
public DecrementAVM2Item(AVM2Instruction instruction, GraphTargetItem object) {
super(instruction, PRECEDENCE_ADDITIVE);
super(instruction, PRECEDENCE_ADDITIVE, object);
}
@Override

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
@@ -35,8 +35,7 @@ import java.util.List;
public class EscapeXAttrAVM2Item extends AVM2Item {
public EscapeXAttrAVM2Item(AVM2Instruction instruction, GraphTargetItem expression) {
super(instruction, NOPRECEDENCE);
this.value = expression;
super(instruction, NOPRECEDENCE, expression);
}
@Override

View File

@@ -35,8 +35,7 @@ import java.util.List;
public class EscapeXElemAVM2Item extends AVM2Item {
public EscapeXElemAVM2Item(AVM2Instruction instruction, GraphTargetItem expression) {
super(instruction, NOPRECEDENCE);
this.value = expression;
super(instruction, NOPRECEDENCE, expression);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -26,8 +27,7 @@ import java.util.Set;
public class IncrementAVM2Item extends AVM2Item {
public IncrementAVM2Item(AVM2Instruction instruction, GraphTargetItem object) {
public IncrementAVM2Item(AVM2Instruction instruction, GraphTargetItem object) {
super(instruction, PRECEDENCE_ADDITIVE);
super(instruction, PRECEDENCE_ADDITIVE, object);
}
@Override

View File

@@ -31,10 +31,9 @@ public class InitPropertyAVM2Item extends AVM2Item implements SetTypeAVM2Item, A
//public GraphTargetItem value;
public InitPropertyAVM2Item(AVM2Instruction instruction, GraphTargetItem object, FullMultinameAVM2Item propertyName, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.object = object;
this.propertyName = propertyName;
this.value = value;
}
@Override

View File

@@ -28,9 +28,8 @@ public class NameValuePair extends AVM2Item {
//public GraphTargetItem value;
public NameValuePair(GraphTargetItem name, GraphTargetItem value) {
super(name.getSrc(), NOPRECEDENCE);
super(name.getSrc(), NOPRECEDENCE, value);
this.name = name;
this.value = value;
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -32,8 +33,7 @@ public class ReturnValueAVM2Item extends AVM2Item implements ExitItem {
//public GraphTargetItem value;
public ReturnValueAVM2Item(AVM2Instruction instruction, GraphTargetItem value) {
public ReturnValueAVM2Item(AVM2Instruction instruction, GraphTargetItem value) {
super(instruction, NOPRECEDENCE);
super(instruction, NOPRECEDENCE, value);
}
@Override

View File

@@ -34,9 +34,8 @@ public class SetGlobalSlotAVM2Item extends AVM2Item {
}
public SetGlobalSlotAVM2Item(AVM2Instruction instruction, int slotId, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.slotId = slotId;
this.value = value;
}
@Override

View File

@@ -40,9 +40,8 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig
//public GraphTargetItem value;
public SetLocalAVM2Item(AVM2Instruction instruction, int regIndex, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.regIndex = regIndex;
this.value = value;
}
@Override

View File

@@ -33,9 +33,8 @@ public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assign
public GraphTargetItem scope;
public SetSlotAVM2Item(AVM2Instruction instruction, GraphTargetItem scope, Multiname slotName, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.slotName = slotName;
this.value = value;
this.scope = scope;
}

View File

@@ -36,8 +36,7 @@ public class SetSuperAVM2Item extends AVM2Item {
}
public SetSuperAVM2Item(AVM2Instruction instruction, GraphTargetItem value, GraphTargetItem object, FullMultinameAVM2Item propertyName) {
super(instruction, PRECEDENCE_ASSIGMENT);
this.value = value;
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.object = object;
this.propertyName = propertyName;
}

View File

@@ -33,8 +33,7 @@ public class ThrowAVM2Item extends AVM2Item implements ExitItem {
//public GraphTargetItem value;
public ThrowAVM2Item(AVM2Instruction instruction, GraphTargetItem value) {
super(instruction, NOPRECEDENCE);
this.value = value;
super(instruction, NOPRECEDENCE, value);
}
@Override

View File

@@ -50,11 +50,10 @@ public class ConstAVM2Item extends AVM2Item {
}
public ConstAVM2Item(String pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
super(null, NOPRECEDENCE);
super(null, NOPRECEDENCE, value);
this.pkg = pkg;
this.line = line;
this.namespace = namespace;
this.value = value;
this.isStatic = isStatic;
this.var = var;
this.type = type;

View File

@@ -50,11 +50,10 @@ public class SlotAVM2Item extends AVM2Item {
}
public SlotAVM2Item(String pkg, String customNamespace, boolean isStatic, int namespace, String var, GraphTargetItem type, GraphTargetItem value, int line) {
super(null, NOPRECEDENCE);
super(null, NOPRECEDENCE, value);
this.pkg = pkg;
this.line = line;
this.namespace = namespace;
this.value = value;
this.isStatic = isStatic;
this.var = var;
this.type = type;

View File

@@ -39,8 +39,7 @@ import java.util.List;
public class XMLAVM2Item extends AVM2Item {
public XMLAVM2Item(GraphTargetItem value) {
super(null, PRECEDENCE_PRIMARY);
this.value = value;
super(null, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -38,8 +38,7 @@ public class XMLFilterAVM2Item extends AVM2Item {
public GraphTargetItem object;
public XMLFilterAVM2Item(GraphTargetItem object, GraphTargetItem value, List<Integer> openedNamespaces) {
super(null, NOPRECEDENCE);
this.value = value;
super(null, NOPRECEDENCE, value);
this.openedNamespaces = openedNamespaces;
this.object = object;
}

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -39,6 +40,10 @@ public abstract class ActionItem extends GraphTargetItem implements Serializable
super(instruction, precedence);
}
public ActionItem(GraphSourceItem instruction, int precedence, GraphTargetItem value) {
super(instruction, precedence, value);
}
protected boolean isEmptyString(GraphTargetItem target) {
if (target instanceof DirectValueActionItem) {
if (((DirectValueActionItem) target).value instanceof String) {

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class AsciiToCharActionItem extends ActionItem {
public AsciiToCharActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public AsciiToCharActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class CallActionItem extends ActionItem {
public CallActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public CallActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,8 +31,7 @@ import java.util.Set;
public class CharToAsciiActionItem extends ActionItem {
public CharToAsciiActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public CharToAsciiActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -68,9 +68,8 @@ public class DefineLocalActionItem extends ActionItem implements SetTypeActionIt
}
public DefineLocalActionItem(GraphSourceItem instruction, GraphTargetItem name, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
this.name = name;
this.value = value;
}
@Override

View File

@@ -43,6 +43,8 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
public GraphTargetItem computedRegValue;
public int pos = -1;
public DirectValueActionItem(Object o) {
this(null, 0, o, new ArrayList<>());
}
@@ -54,6 +56,11 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
this.pos = instructionPos;
}
@Override
protected int getPos() {
return pos;
}
@Override
public boolean isVariableComputed() {
if (computedRegValue != null) {

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -32,8 +33,7 @@ import java.util.List;
public class EvalActionItem extends ActionItem {
public EvalActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public EvalActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class MBAsciiToCharActionItem extends ActionItem {
public MBAsciiToCharActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public MBAsciiToCharActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class MBCharToAsciiActionItem extends ActionItem {
public MBCharToAsciiActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public MBCharToAsciiActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -45,8 +45,7 @@ public class MBStringExtractActionItem extends ActionItem {
}
public MBStringExtractActionItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) {
super(instruction, PRECEDENCE_PRIMARY);
this.value = value;
super(instruction, PRECEDENCE_PRIMARY, value);
this.index = index;
this.count = count;
}

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,8 +31,7 @@ public class MBStringLengthActionItem extends ActionItem {
//public GraphTargetItem value;
public MBStringLengthActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public MBStringLengthActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class RandomNumberActionItem extends ActionItem {
public RandomNumberActionItem(GraphSourceItem instruction, GraphTargetItem maximum) {
public RandomNumberActionItem(GraphSourceItem instruction, GraphTargetItem maximum) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, maximum);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class RemoveSpriteActionItem extends ActionItem {
public RemoveSpriteActionItem(GraphSourceItem instruction, GraphTargetItem target) {
public RemoveSpriteActionItem(GraphSourceItem instruction, GraphTargetItem target) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, target);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SWF;
@@ -42,8 +43,7 @@ public class ReturnActionItem extends ActionItem implements ExitItem {
//public GraphTargetItem value;
public ReturnActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public ReturnActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -77,10 +77,9 @@ public class SetMemberActionItem extends ActionItem implements SetTypeActionItem
}
public SetMemberActionItem(GraphSourceItem instruction, GraphTargetItem object, GraphTargetItem objectName, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.object = object;
this.objectName = objectName;
this.value = value;
}
@Override

View File

@@ -68,10 +68,9 @@ public class SetPropertyActionItem extends ActionItem implements SetTypeActionIt
}
public SetPropertyActionItem(GraphSourceItem instruction, GraphTargetItem target, int propertyIndex, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.target = target;
this.propertyIndex = propertyIndex;
this.value = value;
}
@Override

View File

@@ -67,9 +67,8 @@ public class SetVariableActionItem extends ActionItem implements SetTypeActionIt
}
public SetVariableActionItem(GraphSourceItem instruction, GraphTargetItem name, GraphTargetItem value) {
super(instruction, PRECEDENCE_ASSIGMENT);
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.name = name;
this.value = value;
}
@Override

View File

@@ -67,8 +67,7 @@ public class StoreRegisterActionItem extends ActionItem implements SetTypeAction
}
public StoreRegisterActionItem(GraphSourceItem instruction, RegisterNumber register, GraphTargetItem value, boolean define) {
super(instruction, PRECEDENCE_ASSIGMENT);
this.value = value;
super(instruction, PRECEDENCE_ASSIGMENT, value);
this.register = register;
this.define = define;
}

View File

@@ -35,8 +35,7 @@ public class StringExtractActionItem extends ActionItem {
public GraphTargetItem count;
public StringExtractActionItem(GraphSourceItem instruction, GraphTargetItem value, GraphTargetItem index, GraphTargetItem count) {
super(instruction, PRECEDENCE_PRIMARY);
this.value = value;
super(instruction, PRECEDENCE_PRIMARY, value);
this.index = index;
this.count = count;
}

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,8 +31,7 @@ public class StringLengthActionItem extends ActionItem {
//public GraphTargetItem value;
public StringLengthActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public StringLengthActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class TargetPathActionItem extends ActionItem {
public TargetPathActionItem(GraphSourceItem instruction, GraphTargetItem object) {
public TargetPathActionItem(GraphSourceItem instruction, GraphTargetItem object) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, object);
}
@Override

View File

@@ -31,8 +31,7 @@ public class TemporaryRegister extends ActionItem {
private final int regId;
public TemporaryRegister(int regId, GraphTargetItem value) {
super(value.getSrc(), value.getPrecedence());
this.value = value;
super(value.getSrc(), value.getPrecedence(), value);
this.regId = regId;
}

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class ThrowActionItem extends ActionItem {
public ThrowActionItem(GraphSourceItem instruction, GraphTargetItem object) {
public ThrowActionItem(GraphSourceItem instruction, GraphTargetItem object) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, object);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class ToIntegerActionItem extends ActionItem {
public ToIntegerActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public ToIntegerActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class ToNumberActionItem extends ActionItem {
public ToNumberActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public ToNumberActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class ToStringActionItem extends ActionItem {
public ToStringActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public ToStringActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -29,8 +30,7 @@ import java.util.List;
public class TraceActionItem extends ActionItem {
public TraceActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public TraceActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -32,8 +33,7 @@ import java.util.Set;
public class TypeOfActionItem extends ActionItem {
public TypeOfActionItem(GraphSourceItem instruction, GraphTargetItem value) {
public TypeOfActionItem(GraphSourceItem instruction, GraphTargetItem value) {
super(instruction, PRECEDENCE_PRIMARY);
super(instruction, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -72,8 +72,6 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
private GraphSourceItem src;
public int pos = -1;
protected int precedence;
private List<GraphSourceItemPos> moreSrc;
@@ -118,6 +116,12 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
this.precedence = precedence;
}
public GraphTargetItem(GraphSourceItem src, int precedence, GraphTargetItem value) {
this.src = src;
this.precedence = precedence;
this.value = value;
}
public GraphSourceItem getSrc() {
return src;
}
@@ -138,9 +142,13 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
return srcData;
}
protected int getPos() {
return 0;
}
public List<GraphSourceItemPos> getNeededSources() {
List<GraphSourceItemPos> ret = new ArrayList<>();
ret.add(new GraphSourceItemPos(src, pos));
ret.add(new GraphSourceItemPos(src, getPos()));
if (moreSrc != null) {
ret.addAll(moreSrc);
}
@@ -153,7 +161,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toStringSemicoloned(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.startOffset(src, pos, srcData);
writer.startOffset(src, getPos(), srcData);
appendTo(writer, localData);
if (needsSemicolon()) {
writer.appendNoHilight(";");
@@ -176,7 +184,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
throw new InterruptedException();
}
writer.startOffset(src, pos, srcData);
writer.startOffset(src, getPos(), srcData);
appendTo(writer, localData);
writer.endOffset();
return writer;
@@ -221,7 +229,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toStringNoQuotes(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.startOffset(src, pos, srcData);
writer.startOffset(src, getPos(), srcData);
appendToNoQuotes(writer, localData);
writer.endOffset();
return writer;
@@ -244,7 +252,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
}
public GraphTextWriter toStringNL(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.startOffset(src, pos, srcData);
writer.startOffset(src, getPos(), srcData);
appendTo(writer, localData);
if (needsNewLine()) {
writer.newLine();

View File

@@ -27,7 +27,7 @@ import java.util.logging.Logger;
*/
public class TranslateStack extends Stack<GraphTargetItem> {
private static PopItem pop = new PopItem(null);
private static PopItem pop;
private final String path;
@@ -39,12 +39,20 @@ public class TranslateStack extends Stack<GraphTargetItem> {
return path;
}
private PopItem getPop() {
if (pop == null) {
pop = new PopItem(null);
}
return pop;
}
@Override
public synchronized GraphTargetItem get(int index) {
if (path != null) {
if (index >= this.size() || index < 0) {
Logger.getLogger(TranslateStack.class.getName()).log(Level.FINE, "{0}: Attemp to Get item outside of bounds of stack", path);
return pop;
return getPop();
}
}
return super.get(index);
@@ -55,7 +63,7 @@ public class TranslateStack extends Stack<GraphTargetItem> {
if (path != null) {
if (this.isEmpty()) {
Logger.getLogger(TranslateStack.class.getName()).log(Level.FINE, "{0}: Attemp to Peek empty stack", path);
return pop;
return getPop();
}
}
return super.peek();
@@ -65,8 +73,8 @@ public class TranslateStack extends Stack<GraphTargetItem> {
public synchronized GraphTargetItem pop() {
if (path != null) {
if (this.isEmpty()) {
PopItem oldpop = pop;
pop = new PopItem(null);
PopItem oldpop = getPop();
pop = null;
Logger.getLogger(TranslateStack.class.getName()).log(Level.FINE, "{0}: Attemp to Pop empty stack", path);
return oldpop;
}

View File

@@ -34,8 +34,7 @@ import java.util.Set;
public class DuplicateItem extends GraphTargetItem implements SimpleValue {
public DuplicateItem(GraphSourceItem src, GraphTargetItem value) {
super(src, value.getPrecedence());
this.value = value;
super(src, value.getPrecedence(), value);
}
@Override

View File

@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.graph.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -30,8 +31,7 @@ import java.util.List;
public class ParenthesisItem extends GraphTargetItem {
public ParenthesisItem(GraphSourceItem src, GraphTargetItem value) {
public ParenthesisItem(GraphSourceItem src, GraphTargetItem value) {
super(src, PRECEDENCE_PRIMARY);
super(src, PRECEDENCE_PRIMARY, value);
}
@Override

View File

@@ -25,9 +25,8 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
*/
public class PushItem extends GraphTargetItem {
public PushItem(GraphTargetItem val) {
super(val.getSrc(), val.getPrecedence());
this.value = val;
public PushItem(GraphTargetItem value) {
super(value.getSrc(), value.getPrecedence(), value);
}
@Override

View File

@@ -28,8 +28,7 @@ public abstract class UnaryOpItem extends GraphTargetItem implements UnaryOp {
public String operator;
public UnaryOpItem(GraphSourceItem instruction, int precedence, GraphTargetItem value, String operator) {
super(instruction, precedence);
this.value = value;
super(instruction, precedence, value);
this.operator = operator;
}