[vala/0.48] codegen: Improve handling of ellipsis parameter in get_ccode_name()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [vala/0.48] codegen: Improve handling of ellipsis parameter in get_ccode_name()
- Date: Sun,  4 Apr 2021 13:44:04 +0000 (UTC)
commit 6ad51f945b17349a4e654691ab8069e5ae031690
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Apr 1 15:33:43 2021 +0200
    codegen: Improve handling of ellipsis parameter in get_ccode_name()
 codegen/valaccodeattribute.vala | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index e647b4152..b1e84583e 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -771,7 +771,18 @@ public class Vala.CCodeAttribute : AttributeCache {
                                }
                        } else if (sym is Signal) {
                                return Symbol.camel_case_to_lower_case (sym.name).replace ("_", "-");;
-                       } else if (sym is LocalVariable || sym is Parameter) {
+                       } else if (sym is LocalVariable) {
+                               unowned string name = sym.name;
+                               if (CCodeBaseModule.reserved_identifiers.contains (name)) {
+                                       return "_%s_".printf (name);
+                               } else {
+                                       return name;
+                               }
+                       } else if (sym is Parameter) {
+                               unowned Parameter param = (Parameter) sym;
+                               if (param.ellipsis) {
+                                       return "...";
+                               }
                                unowned string name = sym.name;
                                if (CCodeBaseModule.reserved_identifiers.contains (name)) {
                                        return "_%s_".printf (name);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]