diff options
author | Luca Bruno <lucabru@src.gnome.org> | 2011-05-05 17:18:32 +0200 |
---|---|---|
committer | Luca Bruno <lucabru@src.gnome.org> | 2011-05-05 17:22:52 +0200 |
commit | 295ff27a469a1d093dc72e6e8c44383b98266491 (patch) | |
tree | 907c054ff9b2273970ce0c97e1642945d770f78d /codegen/valagdbusservermodule.vala | |
parent | 9a9a65b099d005955609bfce505b205cb071667d (diff) | |
download | vala-295ff27a469a1d093dc72e6e8c44383b98266491.tar.gz |
codegen: Fix the transformation of elseif cascades using ccode
Diffstat (limited to 'codegen/valagdbusservermodule.vala')
-rw-r--r-- | codegen/valagdbusservermodule.vala | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala index 78fd7d53b..8c1507d8e 100644 --- a/codegen/valagdbusservermodule.vala +++ b/codegen/valagdbusservermodule.vala @@ -719,11 +719,13 @@ public class Vala.GDBusServerModule : GDBusClientModule { ccheck.add_argument (new CCodeIdentifier ("property_name")); ccheck.add_argument (new CCodeConstant ("\"%s\"".printf (get_dbus_name_for_member (prop)))); - if (!firstif) { - ccode.add_else (); + var cond = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccheck, new CCodeConstant ("0")); + if (firstif) { + ccode.open_if (cond); + firstif = false; + } else { + ccode.else_if (cond); } - ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccheck, new CCodeConstant ("0"))); - firstif = false; var ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_dbus_property_get_wrapper (prop, sym))); ccall.add_argument (new CCodeIdentifier ("object")); @@ -781,11 +783,13 @@ public class Vala.GDBusServerModule : GDBusClientModule { ccheck.add_argument (new CCodeIdentifier ("property_name")); ccheck.add_argument (new CCodeConstant ("\"%s\"".printf (get_dbus_name_for_member (prop)))); - if (!firstif) { - ccode.add_else (); + var cond = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccheck, new CCodeConstant ("0")); + if (firstif) { + ccode.open_if (cond); + firstif = false; + } else { + ccode.else_if (cond); } - ccode.open_if (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, ccheck, new CCodeConstant ("0"))); - firstif = false; var ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_dbus_property_set_wrapper (prop, sym))); ccall.add_argument (new CCodeIdentifier ("object")); |