]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
genieparser: Don't create VoidType unconditionally
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Feb 2019 08:51:30 +0000 (09:51 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Feb 2019 08:54:17 +0000 (09:54 +0100)
vala/valagenieparser.vala

index f979128ba8cab20cf256e41f1e182f806fefbe54..e1bd9025b316bd03b296d767d8ce381d139bc6b2 100644 (file)
@@ -2892,7 +2892,8 @@ public class Vala.Genie.Parser : CodeVisitor {
 
        Method parse_method_declaration (List<Attribute>? attrs) throws ParseError {
                var begin = get_location ();
-               DataType type = new VoidType ();
+               DataType type;
+
                expect (TokenType.DEF);
                var flags = parse_member_declaration_modifiers ();
 
@@ -2914,6 +2915,8 @@ public class Vala.Genie.Parser : CodeVisitor {
                /* deal with return value */
                if (accept (TokenType.COLON)) {
                        type = parse_type (true, false);
+               } else {
+                       type = new VoidType ();
                }
 
                var type_param_list = parse_type_parameter_list ();
@@ -3737,7 +3740,6 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                if (accept (TokenType.COLON)) {
                        type = parse_type (true, false);
-
                } else {
                        type = new VoidType ();
                }