From 6eb5f2e434038ff8f4a76ffba9fb773620fa70df Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Thu, 14 Nov 2019 21:04:42 +0100 Subject: 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 --- codegen/valaccodebasemodule.vala | 2 +- vala/valaconstant.vala | 7 +++++-- 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; -- cgit v1.2.1