[vala/staging: 2/2] codegen: Interfaces require including "glib-object.h"



commit 6ddab2e11032fe8e05fd290408ea13b09ed81f7b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Dec 6 15:47:35 2018 +0100

    codegen: Interfaces require including "glib-object.h"

 codegen/valagtypemodule.vala      | 2 ++
 tests/Makefile.am                 | 2 ++
 tests/objects/class_only.vala     | 5 +++++
 tests/objects/interface_only.vala | 5 +++++
 4 files changed, 14 insertions(+)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 7c1f1cf03..fb7851c11 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -2084,6 +2084,8 @@ public class Vala.GTypeModule : GErrorModule {
                        }
                }
 
+               decl_space.add_include ("glib-object.h");
+
                var type_struct = new CCodeStruct ("_%s".printf (get_ccode_type_name (iface)));
 
                decl_space.add_type_declaration (new CCodeNewline ());
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a785038b4..d903bf400 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -251,6 +251,7 @@ TESTS = \
        delegates/bug772204.test \
        delegates/bug792077.vala \
        objects/chainup.vala \
+       objects/class_only.vala \
        objects/classes.vala \
        objects/compact-class.vala \
        objects/compact-class-destructor.vala \
@@ -263,6 +264,7 @@ TESTS = \
        objects/initially-unowned.vala \
        objects/fields.vala \
        objects/gsource.vala \
+       objects/interface_only.vala \
        objects/interfaces.vala \
        objects/methods.vala \
        objects/paramspec.vala \
diff --git a/tests/objects/class_only.vala b/tests/objects/class_only.vala
new file mode 100644
index 000000000..eed0531d1
--- /dev/null
+++ b/tests/objects/class_only.vala
@@ -0,0 +1,5 @@
+class Foo {
+}
+
+void main () {
+}
diff --git a/tests/objects/interface_only.vala b/tests/objects/interface_only.vala
new file mode 100644
index 000000000..e81d63719
--- /dev/null
+++ b/tests/objects/interface_only.vala
@@ -0,0 +1,5 @@
+interface Foo {
+}
+
+void main () {
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]