mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-26 09:10:05 +00:00
Fixed #1803 AS3 Direct editation - Colliding catch name with other variable names / arguments
This commit is contained in:
@@ -1771,7 +1771,7 @@ public class ActionScript3Parser {
|
||||
expectedType(SymbolType.COLON);
|
||||
GraphTargetItem etype = type(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, variables);
|
||||
NameAVM2Item e = new NameAVM2Item(etype, lexer.yyline(), false, enamestr, "", new ExceptionAVM2Item(null)/*?*/, true/*?*/, openedNamespaces, abcIndex);
|
||||
variables.add(e);
|
||||
//variables.add(e);
|
||||
catchExceptions.add(e);
|
||||
e.setSlotNumber(1);
|
||||
e.setSlotScope(Integer.MAX_VALUE); //will be changed later
|
||||
@@ -1787,24 +1787,27 @@ public class ActionScript3Parser {
|
||||
if (a instanceof UnresolvedAVM2Item) {
|
||||
UnresolvedAVM2Item ui = (UnresolvedAVM2Item) a;
|
||||
if (ui.getVariableName().equals(DottedChain.parseWithSuffix(e.getVariableName()))) {
|
||||
List<AssignableAVM2Item> catchedVarAsList = new ArrayList<>();
|
||||
catchedVarAsList.add(e);
|
||||
try {
|
||||
ui.resolve(null, null, null, new ArrayList<>(), new ArrayList<>(), abcIndex, new ArrayList<>(), variables);
|
||||
ui.resolve(null, null, null, new ArrayList<>(), new ArrayList<>(), abcIndex, new ArrayList<>(), catchedVarAsList);
|
||||
} catch (CompilationException ex) {
|
||||
// ignore
|
||||
}
|
||||
ui.setSlotNumber(e.getSlotNumber());
|
||||
ui.setSlotScope(e.getSlotScope());
|
||||
variables.remove(a);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catchCommands.add(cc);
|
||||
s = lex();
|
||||
found = true;
|
||||
}
|
||||
//TODO:
|
||||
for (int i = varCnt; i < variables.size(); i++) {
|
||||
/*for (int i = varCnt; i < variables.size(); i++) {
|
||||
AssignableAVM2Item av = variables.get(i);
|
||||
if (av instanceof UnresolvedAVM2Item) {
|
||||
UnresolvedAVM2Item ui = (UnresolvedAVM2Item) av;
|
||||
@@ -1820,7 +1823,7 @@ public class ActionScript3Parser {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
List<GraphTargetItem> finallyCommands = null;
|
||||
if (s.type == SymbolType.FINALLY) {
|
||||
|
||||
@@ -374,8 +374,13 @@ public class NameAVM2Item extends AssignableAVM2Item {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 13 * hash + Objects.hashCode(this.variableName);
|
||||
int hash = 3;
|
||||
hash = 29 * hash + (this.attribute ? 1 : 0);
|
||||
hash = 29 * hash + Objects.hashCode(this.variableName);
|
||||
hash = 29 * hash + (this.definition ? 1 : 0);
|
||||
hash = 29 * hash + this.regNumber;
|
||||
hash = 29 * hash + this.slotNumber;
|
||||
hash = 29 * hash + this.slotScope;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -391,10 +396,24 @@ public class NameAVM2Item extends AssignableAVM2Item {
|
||||
return false;
|
||||
}
|
||||
final NameAVM2Item other = (NameAVM2Item) obj;
|
||||
if (!Objects.equals(this.variableName, other.variableName)) {
|
||||
if (this.attribute != other.attribute) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (this.definition != other.definition) {
|
||||
return false;
|
||||
}
|
||||
if (this.regNumber != other.regNumber) {
|
||||
return false;
|
||||
}
|
||||
if (this.slotNumber != other.slotNumber) {
|
||||
return false;
|
||||
}
|
||||
if (this.slotScope != other.slotScope) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.variableName, other.variableName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
if (resolved == null) {
|
||||
throw new RuntimeException("Unresolved");
|
||||
throw new RuntimeException("Unresolved: " + toString());
|
||||
}
|
||||
return resolved.toSource(localData, generator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user