summaryrefslogtreecommitdiff
path: root/ccode
diff options
context:
space:
mode:
authorMason Bogue <scythe@ortsz.com>2020-03-21 19:14:51 -0400
committerRico Tzschichholz <ricotz@ubuntu.com>2020-04-05 11:06:56 +0200
commit3d7760835e56a04a939c17a35a6db1c542415d6d (patch)
treebf22ab494290e02aef011a23d49f07759427e622 /ccode
parentd02167aff9da38e85d7cdc21fff2b91ba9e35e9d (diff)
downloadvala-3d7760835e56a04a939c17a35a6db1c542415d6d.tar.gz
codegen: Use defintions of public header in internal header if available
Add CCode API to distinguish between public and internal header files. See https://gitlab.gnome.org/GNOME/vala/issues/713
Diffstat (limited to 'ccode')
-rw-r--r--ccode/valaccodefile.vala14
1 files changed, 12 insertions, 2 deletions
diff --git a/ccode/valaccodefile.vala b/ccode/valaccodefile.vala
index cf4870267..a82eac5c0 100644
--- a/ccode/valaccodefile.vala
+++ b/ccode/valaccodefile.vala
@@ -22,7 +22,7 @@
public class Vala.CCodeFile {
- public bool is_header { get; set; }
+ public CCodeFileType cfile_type { get; set; }
public weak SourceFile? file { get; private set; }
@@ -41,6 +41,9 @@ public class Vala.CCodeFile {
public CCodeFile (SourceFile? source_file = null) {
file = source_file;
+ if (source_file != null) {
+ cfile_type = CCodeFileType.SOURCE;
+ }
}
public bool add_declaration (string name) {
@@ -151,7 +154,7 @@ public class Vala.CCodeFile {
return false;
}
- if (!is_header) {
+ if (cfile_type == CCodeFileType.SOURCE) {
writer.line_directives = line_directives;
comments.write (writer);
@@ -210,3 +213,10 @@ public class Vala.CCodeFile {
}
}
+[Flags]
+public enum CCodeFileType {
+ SOURCE,
+ PUBLIC_HEADER,
+ INTERNAL_HEADER,
+ HEADER = PUBLIC_HEADER | INTERNAL_HEADER
+}