]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Detect and replace "-" in parameter names
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 22 Oct 2019 16:42:16 +0000 (18:42 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 22 Oct 2019 16:44:36 +0000 (18:44 +0200)
... to avoid generating bindings with invalid syntax.

vala/valagirparser.vala

index 54c541c7955f7081fa0a230a0c5630be85f6028d..4213824b2a85c1a1ccc48cdf5f4f7ea103f1720c 100644 (file)
@@ -2483,6 +2483,9 @@ public class Vala.GirParser : CodeVisitor {
                }
                if (name == null) {
                        name = default_name;
+               } else if (name.contains ("-")) {
+                       Report.warning (get_current_src (), "parameter name contains hyphen");
+                       name = name.replace ("-", "_");
                }
                string direction = null;
                if (metadata.has_argument (ArgumentType.OUT)) {