summaryrefslogtreecommitdiffstats
path: root/src/de/fernflower/modules/decompiler/exps/FunctionExprent.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/fernflower/modules/decompiler/exps/FunctionExprent.java')
-rw-r--r--src/de/fernflower/modules/decompiler/exps/FunctionExprent.java71
1 files changed, 38 insertions, 33 deletions
diff --git a/src/de/fernflower/modules/decompiler/exps/FunctionExprent.java b/src/de/fernflower/modules/decompiler/exps/FunctionExprent.java
index 2610b33..2f75b71 100644
--- a/src/de/fernflower/modules/decompiler/exps/FunctionExprent.java
+++ b/src/de/fernflower/modules/decompiler/exps/FunctionExprent.java
@@ -368,43 +368,48 @@ public class FunctionExprent extends Exprent {
break;
case FUNCTION_AND:
case FUNCTION_OR:
- case FUNCTION_XOR:
- if(type1.type == CodeConstants.TYPE_BOOLEAN &&
- ((type1.convinfo & VarType.FALSEBOOLEAN) != 0 || type2.type != CodeConstants.TYPE_BOOLEAN)) {
- result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
- }
- if(type2.type == CodeConstants.TYPE_BOOLEAN &&
- ((type2.convinfo & VarType.FALSEBOOLEAN) != 0 || type1.type != CodeConstants.TYPE_BOOLEAN)) {
- result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
+ case FUNCTION_XOR:
+ {
+ boolean param1_false_boolean = type1.isFalseBoolean() || (param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue());
+ boolean param2_false_boolean = type1.isFalseBoolean() || (param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue());
+
+ if(param1_false_boolean || param2_false_boolean) {
+ if(type1.type == CodeConstants.TYPE_BOOLEAN) {
+ result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
+ }
+
+ if(type2.type == CodeConstants.TYPE_BOOLEAN) {
+ result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
+ }
+ }
}
break;
case FUNCTION_EQ:
case FUNCTION_NE:
-
- if(type1.type == CodeConstants.TYPE_BOOLEAN) {
-
- if(type2.isStrictSuperset(type1)) {
- result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
- } else {
- if(param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue()) {
- if(param2.type != Exprent.EXPRENT_CONST || !((ConstExprent)param2).hasBooleanValue()) { // variable or not boolean constant
- result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
- }
- }
- }
- }
-
- if(type2.type == CodeConstants.TYPE_BOOLEAN) {
-
- if(type1.isStrictSuperset(type2)) {
- result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
- } else {
- if(param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue()) {
- if(param1.type != Exprent.EXPRENT_CONST || !((ConstExprent)param1).hasBooleanValue()) { // variable or not boolean constant
- result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
- }
- }
- }
+ {
+ if(type1.type == CodeConstants.TYPE_BOOLEAN) {
+
+ if(type2.isStrictSuperset(type1)) {
+
+ result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
+
+ } else { // both are booleans
+
+ boolean param1_false_boolean = type1.isFalseBoolean() || (param1.type == Exprent.EXPRENT_CONST && !((ConstExprent)param1).hasBooleanValue());
+ boolean param2_false_boolean = type1.isFalseBoolean() || (param2.type == Exprent.EXPRENT_CONST && !((ConstExprent)param2).hasBooleanValue());
+
+ if(param1_false_boolean || param2_false_boolean) {
+ result.addMinTypeExprent(param1, VarType.VARTYPE_BYTECHAR);
+ result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
+ }
+ }
+
+ } else if(type2.type == CodeConstants.TYPE_BOOLEAN) {
+
+ if(type1.isStrictSuperset(type2)) {
+ result.addMinTypeExprent(param2, VarType.VARTYPE_BYTECHAR);
+ }
+ }
}
}