AS3:Fixed with statements

This commit is contained in:
Jindra Pet��k
2013-01-01 13:19:51 +01:00
parent 2f2c95a11a
commit 45ff89c36f
3 changed files with 44 additions and 1 deletions
@@ -23,6 +23,7 @@ import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.WithObjectTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.WithTreeItem;
import com.jpexs.asdec.abc.types.MethodBody;
import com.jpexs.asdec.abc.types.MethodInfo;
@@ -45,6 +46,9 @@ public class PopScopeIns extends InstructionDefinition {
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
TreeItem scope = (TreeItem) scopeStack.pop();
if(scope instanceof WithObjectTreeItem){
scope = ((WithObjectTreeItem)scope).scope;
}
for (int i = output.size() - 1; i >= 0; i--) {
if (output.get(i) instanceof WithTreeItem) {
WithTreeItem wti = (WithTreeItem) output.get(i);
@@ -21,6 +21,7 @@ import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.WithObjectTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.WithTreeItem;
import com.jpexs.asdec.abc.types.MethodBody;
import com.jpexs.asdec.abc.types.MethodInfo;
@@ -37,7 +38,8 @@ public class PushWithIns extends InstructionDefinition {
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
TreeItem w = (TreeItem) stack.pop();
scopeStack.push(w);
WithObjectTreeItem wot = new WithObjectTreeItem(ins,w);
scopeStack.push(wot);
output.add(new WithTreeItem(ins, w));
}
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2010-2011 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.asdec.abc.avm2.treemodel;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import java.util.HashMap;
import java.util.List;
public class WithObjectTreeItem extends TreeItem {
public TreeItem scope;
public WithObjectTreeItem(AVM2Instruction instruction, TreeItem scope) {
super(instruction, PRECEDENCE_PRIMARY);
this.scope = scope;
}
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames) {
return "";
}
}