summaryrefslogtreecommitdiff
path: root/vala/valaconstant.vala
diff options
context:
space:
mode:
Diffstat (limited to 'vala/valaconstant.vala')
-rw-r--r--vala/valaconstant.vala25
1 files changed, 25 insertions, 0 deletions
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 6d31c5787..4dfac387c 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -150,4 +150,29 @@ public class Vala.Constant : Member, Lockable {
}
}
}
+
+ public override bool check (SemanticAnalyzer analyzer) {
+ if (checked) {
+ return !error;
+ }
+
+ checked = true;
+
+ process_attributes ();
+
+ type_reference.accept (analyzer);
+
+ if (!external_package) {
+ if (initializer == null) {
+ error = true;
+ Report.error (source_reference, "A const field requires a initializer to be provided");
+ } else {
+ initializer.target_type = type_reference;
+
+ initializer.accept (analyzer);
+ }
+ }
+
+ return !error;
+ }
}