[vala/0.40] vala: Set default_construction_method in semantic-analyzer check if required
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] vala: Set default_construction_method in semantic-analyzer check if required
- Date: Tue, 21 Apr 2020 07:49:34 +0000 (UTC)
commit 53c087f8d03dd1e0a150e8592a1c66b9a520d5c5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Apr 8 14:32:07 2020 +0200
vala: Set default_construction_method in semantic-analyzer check if required
Doing this in the parser is not reasonable while this is clearly a sematic
requirement.
vala/valaclass.vala | 9 +++++++++
vala/valaparser.vala | 9 ---------
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 532acc19d..bad6ea51a 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -504,6 +504,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;
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 74eb2e3fe..26e9c6625 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2597,15 +2597,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]