summaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2022-12-14 17:22:44 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2022-12-22 17:00:29 +0100
commita67d19f51082944e3751760d6c0ae09efc35b860 (patch)
tree1c6ad3be7cfbff441d290f572b65f38ff339dd78 /codegen
parent144566870cb7263ba7827459bf2ec2a9aa86e193 (diff)
downloadvala-a67d19f51082944e3751760d6c0ae09efc35b860.tar.gz
codegen: Use a special CCodeBinaryExpression for string comparisons
This preserves support for recursive replacement of arguments while this expression was actually transformed into a function call.
Diffstat (limited to 'codegen')
-rw-r--r--codegen/valaccodebasemodule.vala15
1 files changed, 7 insertions, 8 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c2eefe02c..2969679c9 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5912,24 +5912,23 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
case BinaryOperator.GREATER_THAN:
case BinaryOperator.LESS_THAN_OR_EQUAL:
case BinaryOperator.GREATER_THAN_OR_EQUAL:
- CCodeFunctionCall ccall;
+ CCodeExpression call;
if (context.profile == Profile.POSIX) {
cfile.add_include ("string.h");
- ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp"))));
+ call = new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp")));
} else {
- ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0"));
+ call = new CCodeIdentifier ("g_strcmp0");
}
- ccall.add_argument (cleft);
- ccall.add_argument (cright);
- cleft = ccall;
- cright = new CCodeConstant ("0");
+ set_cvalue (expr, new CCodeBinaryCompareExpression (call, op, cleft, cright, new CCodeConstant ("0")));
break;
default:
+ set_cvalue (expr, new CCodeBinaryExpression (op, cleft, cright));
break;
}
+ } else {
+ set_cvalue (expr, new CCodeBinaryExpression (op, cleft, cright));
}
- set_cvalue (expr, new CCodeBinaryExpression (op, cleft, cright));
if (left_chain != null) {
set_cvalue (expr, new CCodeBinaryExpression (CCodeBinaryOperator.AND, left_chain, get_cvalue (expr)));
}