Add char literal type inference to add/sub operators

master
Graham 5 years ago
parent 24c93c3c50
commit 317e26e299
  1. 16
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java

@ -433,15 +433,8 @@ public class FunctionExprent extends Exprent {
public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) {
tracer.addMapping(bytecode); tracer.addMapping(bytecode);
if (funcType <= FUNCTION_USHR) {
return wrapOperandString(lstOperands.get(0), false, indent, tracer)
.append(OPERATORS[funcType])
.append(wrapOperandString(lstOperands.get(1), true, indent, tracer));
}
// try to determine more accurate type for 'char' literals // try to determine more accurate type for 'char' literals
if (funcType >= FUNCTION_EQ) { if (funcType <= FUNCTION_SUB || (funcType >= FUNCTION_EQ && funcType <= FUNCTION_LE)) {
if (funcType <= FUNCTION_LE) {
Exprent left = lstOperands.get(0); Exprent left = lstOperands.get(0);
Exprent right = lstOperands.get(1); Exprent right = lstOperands.get(1);
@ -453,6 +446,13 @@ public class FunctionExprent extends Exprent {
} }
} }
if (funcType <= FUNCTION_USHR) {
return wrapOperandString(lstOperands.get(0), false, indent, tracer)
.append(OPERATORS[funcType])
.append(wrapOperandString(lstOperands.get(1), true, indent, tracer));
}
if (funcType >= FUNCTION_EQ) {
return wrapOperandString(lstOperands.get(0), false, indent, tracer) return wrapOperandString(lstOperands.get(0), false, indent, tracer)
.append(OPERATORS[funcType - FUNCTION_EQ + 11]) .append(OPERATORS[funcType - FUNCTION_EQ + 11])
.append(wrapOperandString(lstOperands.get(1), true, indent, tracer)); .append(wrapOperandString(lstOperands.get(1), true, indent, tracer));

Loading…
Cancel
Save