mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-15 19:38:19 +00:00
Non nullable flag
This commit is contained in:
@@ -874,6 +874,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
if (cai.isFinal) {
|
||||
ii.flags |= InstanceInfo.CLASS_FINAL;
|
||||
}
|
||||
if (!cai.isNullable) {
|
||||
ii.flags |= InstanceInfo.CLASS_NON_NULLABLE;
|
||||
}
|
||||
ii.flags |= InstanceInfo.CLASS_PROTECTEDNS;
|
||||
ii.protectedNS = abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PROTECTED, pkg.toRawString().isEmpty() ? cai.classBaseName : pkg.toRawString() + ":" + cai.classBaseName, 0, true);
|
||||
}
|
||||
@@ -881,6 +884,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
InterfaceAVM2Item iai = (InterfaceAVM2Item) cls;
|
||||
ii.flags |= InstanceInfo.CLASS_INTERFACE;
|
||||
ii.flags |= InstanceInfo.CLASS_SEALED;
|
||||
if (!iai.isNullable) {
|
||||
ii.flags |= InstanceInfo.CLASS_NON_NULLABLE;
|
||||
}
|
||||
generateClass(iai.importedClasses, new ArrayList<>(), false, new ArrayList<>(),
|
||||
iai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, true, iai.baseName, null, null, iai.superInterfaces, null, null, false, iai.methods,
|
||||
class_index
|
||||
|
||||
@@ -1059,6 +1059,16 @@ public class ActionScript3Parser {
|
||||
expected(s, lexer.yyline(), SymbolGroup.IDENTIFIER);
|
||||
subNameStr = s.value.toString();
|
||||
s = lex();
|
||||
|
||||
boolean nullable = true;
|
||||
|
||||
if (s.type == SymbolType.NOT) {
|
||||
s = lex();
|
||||
nullable = false;
|
||||
} else if (s.type == SymbolType.TERNAR) {
|
||||
s = lex();
|
||||
}
|
||||
|
||||
if (!isInterface) {
|
||||
|
||||
if (s.type == SymbolType.EXTENDS) {
|
||||
@@ -1112,9 +1122,9 @@ public class ActionScript3Parser {
|
||||
classTraits(allOpenedNamespaces, !inPackage, cinitVariables, cinitNeedsActivation, cinit, importedClasses, subOpenedNamespaces, ns, subNameStr, isInterface, subTraits, iinitVariables, iinitNeedsActivation, iinit);
|
||||
|
||||
if (isInterface) {
|
||||
traits.add(new InterfaceAVM2Item(metadata, importedClasses, ns, subOpenedNamespaces, isFinal, subNameStr, interfaces, subTraits));
|
||||
traits.add(new InterfaceAVM2Item(metadata, importedClasses, ns, subOpenedNamespaces, isFinal, subNameStr, interfaces, subTraits, nullable));
|
||||
} else {
|
||||
traits.add(new ClassAVM2Item(metadata, importedClasses, ns, subOpenedNamespaces, isFinal, isDynamic, subNameStr, extendsTypeStr, interfaces, cinit, cinitNeedsActivation.getVal(), cinitVariables, iinit.getVal(), iinitVariables, subTraits, iinitNeedsActivation.getVal()));
|
||||
traits.add(new ClassAVM2Item(metadata, importedClasses, ns, subOpenedNamespaces, isFinal, isDynamic, subNameStr, extendsTypeStr, interfaces, cinit, cinitNeedsActivation.getVal(), cinitVariables, iinit.getVal(), iinitVariables, subTraits, iinitNeedsActivation.getVal(), nullable));
|
||||
}
|
||||
|
||||
expectedType(SymbolType.CURLY_CLOSE);
|
||||
|
||||
@@ -115,6 +115,11 @@ public class ClassAVM2Item extends AVM2Item implements Block {
|
||||
* Metadata
|
||||
*/
|
||||
public List<Map.Entry<String, Map<String, String>>> metadata;
|
||||
|
||||
/**
|
||||
* Is nullable
|
||||
*/
|
||||
public boolean isNullable;
|
||||
|
||||
@Override
|
||||
public List<List<GraphTargetItem>> getSubs() {
|
||||
@@ -148,8 +153,9 @@ public class ClassAVM2Item extends AVM2Item implements Block {
|
||||
* @param iinitVariables Instance initializer variables
|
||||
* @param traits Traits
|
||||
* @param iinitActivation Instance initializer activation
|
||||
* @param isNullable Nullable
|
||||
*/
|
||||
public ClassAVM2Item(List<Map.Entry<String, Map<String, String>>> metadata, List<DottedChain> importedClasses, NamespaceItem pkg, List<NamespaceItem> openedNamespaces, boolean isFinal, boolean isDynamic, String className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> cinit, boolean staticInitActivation, List<AssignableAVM2Item> cinitVariables, GraphTargetItem iinit, List<AssignableAVM2Item> iinitVariables, List<GraphTargetItem> traits, boolean iinitActivation) {
|
||||
public ClassAVM2Item(List<Map.Entry<String, Map<String, String>>> metadata, List<DottedChain> importedClasses, NamespaceItem pkg, List<NamespaceItem> openedNamespaces, boolean isFinal, boolean isDynamic, String className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> cinit, boolean staticInitActivation, List<AssignableAVM2Item> cinitVariables, GraphTargetItem iinit, List<AssignableAVM2Item> iinitVariables, List<GraphTargetItem> traits, boolean iinitActivation, boolean isNullable) {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
this.metadata = metadata;
|
||||
this.importedClasses = importedClasses;
|
||||
@@ -167,6 +173,7 @@ public class ClassAVM2Item extends AVM2Item implements Block {
|
||||
this.cinitActivation = staticInitActivation;
|
||||
this.cinitVariables = cinitVariables;
|
||||
this.iinitVariables = iinitVariables;
|
||||
this.isNullable = isNullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -72,6 +72,11 @@ public class InterfaceAVM2Item extends AVM2Item {
|
||||
*/
|
||||
public List<Map.Entry<String, Map<String, String>>> metadata;
|
||||
|
||||
/**
|
||||
* Is nullable
|
||||
*/
|
||||
public boolean isNullable;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param metadata Metadata
|
||||
@@ -82,8 +87,9 @@ public class InterfaceAVM2Item extends AVM2Item {
|
||||
* @param name Name
|
||||
* @param superInterfaces Super interfaces
|
||||
* @param traits Traits
|
||||
* @param isNullable Nullable
|
||||
*/
|
||||
public InterfaceAVM2Item(List<Map.Entry<String, Map<String, String>>> metadata, List<DottedChain> importedClasses, NamespaceItem pkg, List<NamespaceItem> openedNamespaces, boolean isFinal, String name, List<GraphTargetItem> superInterfaces, List<GraphTargetItem> traits) {
|
||||
public InterfaceAVM2Item(List<Map.Entry<String, Map<String, String>>> metadata, List<DottedChain> importedClasses, NamespaceItem pkg, List<NamespaceItem> openedNamespaces, boolean isFinal, String name, List<GraphTargetItem> superInterfaces, List<GraphTargetItem> traits, boolean isNullable) {
|
||||
super(null, null, NOPRECEDENCE);
|
||||
this.metadata = metadata;
|
||||
this.importedClasses = importedClasses;
|
||||
@@ -93,6 +99,7 @@ public class InterfaceAVM2Item extends AVM2Item {
|
||||
this.methods = traits;
|
||||
this.isFinal = isFinal;
|
||||
this.openedNamespaces = openedNamespaces;
|
||||
this.isNullable = isNullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -102,8 +102,7 @@ public class InstanceInfo {
|
||||
public static final int CLASS_PROTECTEDNS = 8;
|
||||
|
||||
/**
|
||||
* Unknown. This is somehow used in Flex, probably through annotations or
|
||||
* something with Vector datatype (?) TODO: Investigate this
|
||||
* Non nullable class
|
||||
*/
|
||||
public static final int CLASS_NON_NULLABLE = 16;
|
||||
|
||||
@@ -293,6 +292,10 @@ public class InstanceInfo {
|
||||
String classTypeName = abc.constants.getMultiname(name_index).getNameWithNamespace(abc.constants, true).toRawString();
|
||||
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, null/* No full names here*/, false, true), HighlightSpecialType.CLASS_NAME, classTypeName);
|
||||
|
||||
if (!isNullable()) {
|
||||
writer.appendNoHilight("!");
|
||||
}
|
||||
|
||||
if (super_index > 0) {
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc.constants, true).toRawString();
|
||||
|
||||
Reference in New Issue
Block a user