[vala/wip/dbusgen: 44/60] Parameter-names are not mandatory



commit b9db66272bb333ca4f379b3dff21dd83dc94739e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Nov 23 22:15:55 2017 +0100

    Parameter-names are not mandatory

 dbusgen/valadbusparser.vala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index cf5fe3a6d..2872317e1 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -38,6 +38,7 @@ public class Vala.DBusParser : CodeVisitor {
        private Interface current_iface;
        private Callable current_method;
        private Parameter current_param;
+       private uint current_param_index;
        private Property current_property;
 
        private MarkupReader reader;
@@ -239,6 +240,8 @@ public class Vala.DBusParser : CodeVisitor {
        }
 
        private void parse_method_body () {
+               current_param_index = 0U;
+
                while (current_token == MarkupTokenType.START_ELEMENT) {
                        switch (reader.name) {
                                case "annotation":
@@ -309,8 +312,7 @@ public class Vala.DBusParser : CodeVisitor {
 
                string? name = reader.get_attribute ("name");
                if (name == null) {
-                       Report.error (get_current_src () , "Formal Parameters require a name attribute");
-                       return;
+                       name = "arg%u".printf (current_param_index++);
                }
 
                string? type = reader.get_attribute ("type");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]