]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Set default_construction_method in semantic-analyzer check if required
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 8 Apr 2020 12:32:07 +0000 (14:32 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 20 Apr 2020 19:37:32 +0000 (21:37 +0200)
Doing this in the parser is not reasonable while this is clearly a sematic
requirement.

vala/valaclass.vala
vala/valaparser.vala

index 5824ef82257607b36948da5b4c19bcd87452c68b..823106209f9206b5132c38581f042fa4cff66192 100644 (file)
@@ -543,6 +543,15 @@ public class Vala.Class : ObjectTypeSymbol {
 
                checked = true;
 
+               // ensure there is always a default construction method
+               if (default_construction_method == null
+                   && source_reference.file.file_type == SourceFileType.SOURCE) {
+                       var m = new CreationMethod (name, null, source_reference);
+                       m.access = (is_abstract ? SymbolAccessibility.PROTECTED : SymbolAccessibility.PUBLIC);
+                       m.body = new Block (source_reference);
+                       add_method (m);
+               }
+
                var old_source_file = context.analyzer.current_source_file;
                var old_symbol = context.analyzer.current_symbol;
 
index c98430df6c4dbf9c062979cb7a18b97a304b6986..16f24058e042d266f234b372226fec392c440629 100644 (file)
@@ -2604,15 +2604,6 @@ public class Vala.Parser : CodeVisitor {
 
                parse_declarations (cl);
 
-               // ensure there is always a default construction method
-               if (scanner.source_file.file_type == SourceFileType.SOURCE
-                   && cl.default_construction_method == null) {
-                       var m = new CreationMethod (cl.name, null, cl.source_reference);
-                       m.access = (cl.is_abstract ? SymbolAccessibility.PROTECTED : SymbolAccessibility.PUBLIC);
-                       m.body = new Block (cl.source_reference);
-                       cl.add_method (m);
-               }
-
                Symbol result = cl;
                while (sym != null) {
                        sym = sym.inner;