summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-11-14 21:04:42 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2019-11-18 09:34:10 +0100
commit6eb5f2e434038ff8f4a76ffba9fb773620fa70df (patch)
tree8172f71fc3f4fd56df68efb0ed072bd075679054
parent321825c565a6731ef21556132e89e474c3ac75f3 (diff)
downloadvala-6eb5f2e434038ff8f4a76ffba9fb773620fa70df.tar.gz
vala: Don't require constant initializer in fast-vapi
Regression of 984c034256de3830d6daa0ab6f5eff108dea09bb Extend --fast-vapi test by using --use-fast-vapi See https://github.com/dino/dino/issues/646 and https://gitlab.gnome.org/GNOME/vala/issues/461
-rw-r--r--codegen/valaccodebasemodule.vala2
-rw-r--r--vala/valaconstant.vala7
2 files changed, 6 insertions, 3 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index f23c42b42..cb5ee3750 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -961,7 +961,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return;
}
- if (!c.external) {
+ if (!c.external || (c.source_type == SourceFileType.FAST && c.value != null)) {
generate_type_declaration (c.type_reference, decl_space);
c.value.emit (this);
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 0a9266cf1..b98568f33 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -123,8 +123,11 @@ public class Vala.Constant : Symbol {
if (!external) {
if (value == null) {
- error = true;
- Report.error (source_reference, "A const field requires a value to be provided");
+ // constants from fast-vapi files are special
+ if (source_type != SourceFileType.FAST) {
+ error = true;
+ Report.error (source_reference, "A const field requires a value to be provided");
+ }
} else {
value.target_type = type_reference;