From d89e02426ed3dbb3aeebf7533e3c791514b8e25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 23 Sep 2014 21:11:10 +0200 Subject: [PATCH] AS3 direct editing - submethod name resolving fix --- .../com/jpexs/decompiler/flash/SourceGeneratorLocalData.java | 4 +++- .../flash/abc/avm2/parser/script/AVM2SourceGenerator.java | 1 + .../flash/abc/avm2/parser/script/PropertyAVM2Item.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java index 414458a42..b5e2dfb46 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SourceGeneratorLocalData.java @@ -12,7 +12,8 @@ * 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; import com.jpexs.decompiler.flash.abc.types.ABCException; @@ -49,6 +50,7 @@ public class SourceGeneratorLocalData implements Serializable { public List scopeStack = new ArrayList<>(); public boolean documentClass; public ScriptInfo currentScript; + public boolean subMethod = false; public String getFullClass() { return pkg == null || pkg.isEmpty() ? currentClass : pkg + "." + currentClass; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index d18118372..22706a4e0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -1386,6 +1386,7 @@ public class AVM2SourceGenerator implements SourceGenerator { newlocalData.traitUsages = localData.traitUsages; newlocalData.currentScript = localData.currentScript; newlocalData.documentClass = localData.documentClass; + newlocalData.subMethod = subMethod; localData = newlocalData; localData.activationReg = 0; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java index 6070b0576..2f99d8c3e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java @@ -630,7 +630,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item { List abcs = new ArrayList<>(); abcs.add(abc); abcs.addAll(otherABCs); - if (cname != null && AVM2SourceGenerator.searchPrototypeChain(true, abcs, pkgName, cname, propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue) && (localData.currentClass.equals("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal()))) { + if (!localData.subMethod && cname != null && AVM2SourceGenerator.searchPrototypeChain(true, abcs, pkgName, cname, propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue) && (localData.currentClass.equals("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal()))) { NameAVM2Item nobj = new NameAVM2Item(new TypeItem(localData.getFullClass()), 0, "this", null, false, openedNamespaces); nobj.setRegNumber(0); obj = nobj;