fix: inline class constants to fix enum transform (#916)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
# IntelliJ Idea files
|
||||
.idea/
|
||||
.run/
|
||||
out/
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
@@ -100,6 +100,12 @@ public class ConstInlineVisitor extends AbstractVisitor {
|
||||
constArg = InsnArg.wrapArg(constGet);
|
||||
constArg.setType(ArgType.STRING);
|
||||
}
|
||||
} else if (insnType == InsnType.CONST_CLASS) {
|
||||
if (sVar.isUsedInPhi()) {
|
||||
return;
|
||||
}
|
||||
constArg = InsnArg.wrapArg(insn.copyWithoutResult());
|
||||
constArg.setType(ArgType.CLASS);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -293,6 +293,12 @@ public class EnumVisitor extends AbstractVisitor {
|
||||
if (mth == null) {
|
||||
return null;
|
||||
}
|
||||
List<RegisterArg> regs = new ArrayList<>();
|
||||
co.getRegisterArgs(regs);
|
||||
if (!regs.isEmpty()) {
|
||||
cls.addWarnComment("Init of enum " + enumFieldNode.getName() + " can be incorrect");
|
||||
}
|
||||
|
||||
markArgsForSkip(mth);
|
||||
return new EnumField(enumFieldNode, co);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user