mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 06:08:31 +00:00
Issue #516 AS3 P-code editor - Null name namespace handling
This commit is contained in:
@@ -225,12 +225,18 @@ public class ASM3Parser {
|
||||
|
||||
expected(ParsedSymbol.TYPE_PARENT_OPEN, "(", lexer);
|
||||
ParsedSymbol name = lexer.lex();
|
||||
expected(name, ParsedSymbol.TYPE_STRING, "String");
|
||||
if (name.type == ParsedSymbol.TYPE_KEYWORD_NULL) {
|
||||
|
||||
} else if (name.type == ParsedSymbol.TYPE_STRING) {
|
||||
|
||||
} else {
|
||||
throw new ParseException("String or null expected", lexer.yyline());
|
||||
}
|
||||
ParsedSymbol c = lexer.lex();
|
||||
int index = 0;
|
||||
if (c.type == ParsedSymbol.TYPE_COMMA) {
|
||||
ParsedSymbol extra = lexer.lex();
|
||||
expected(name, ParsedSymbol.TYPE_STRING, "String");
|
||||
expected(extra, ParsedSymbol.TYPE_STRING, "String");
|
||||
try {
|
||||
index = Integer.parseInt((String) extra.value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
@@ -241,7 +247,7 @@ public class ASM3Parser {
|
||||
}
|
||||
expected(ParsedSymbol.TYPE_PARENT_CLOSE, ")", lexer);
|
||||
|
||||
return constants.getNamespaceId(new Namespace(kind, constants.getStringId((String) name.value, true)), index, true);
|
||||
return constants.getNamespaceId(new Namespace(kind, name.type == ParsedSymbol.TYPE_KEYWORD_NULL ? 0 : constants.getStringId((String) name.value, true)), index, true);
|
||||
}
|
||||
|
||||
private static int parseMultiName(ConstantPool constants, Flasm3Lexer lexer) throws ParseException, IOException {
|
||||
|
||||
@@ -141,17 +141,18 @@ public class Multiname {
|
||||
return "null";
|
||||
}
|
||||
int type = constants.getNamespace(index).kind;
|
||||
String name = constants.getNamespace(index).getName(constants);
|
||||
int name_index = constants.getNamespace(index).name_index;
|
||||
String name = name_index == 0 ? null : constants.getNamespace(index).getName(constants);
|
||||
int sub = -1;
|
||||
for (int n = 1; n < constants.getNamespaceCount(); n++) {
|
||||
if (constants.getNamespace(n).kind == type && constants.getNamespace(n).getName(constants).equals(name)) {
|
||||
if (constants.getNamespace(n).kind == type && constants.getNamespace(n).getName(constants).equals(constants.getNamespace(index).getName(constants))) {
|
||||
sub++;
|
||||
}
|
||||
if (n == index) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return constants.getNamespace(index).getKindStr() + "(" + "\"" + Helper.escapeString(name) + "\"" + (sub > 0 ? ",\"" + sub + "\"" : "") + ")";
|
||||
return constants.getNamespace(index).getKindStr() + "(" + (name == null ? "null" : "\"" + Helper.escapeString(name) + "\"") + (sub > 0 ? ",\"" + sub + "\"" : "") + ")";
|
||||
}
|
||||
|
||||
private static String namespaceSetToString(ConstantPool constants, int index) {
|
||||
|
||||
Reference in New Issue
Block a user