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

vala/valaclass.vala
vala/valaparser.vala

index 586fe287f86a6a23d33260404fdc38a6b6272b84..d7f148986332bce918da2296eb8c0beb76d5782f 100644 (file)
@@ -524,6 +524,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 e2ec7b4a1bbc3ec850c6b9b889ed6de21d4af7c8..48818a293b3ff9d6ed9917558313304a60d256f6 100644 (file)
@@ -2658,15 +2658,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;