]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Allow to associate CCodeFile to actual SourceFile
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
ccode/valaccodefile.vala
codegen/valaccodebasemodule.vala

index e98d84bd079a3fa54a485b40796609e5d1d835f6..6a8ae8ce310ffb3216b582cedbaf0831f77c47a0 100644 (file)
@@ -24,6 +24,8 @@
 public class Vala.CCodeFile {
        public bool is_header { get; set; }
 
+       public weak SourceFile? file { get; private set; }
+
        Set<string> features = new HashSet<string> (str_hash, str_equal);
        Set<string> declarations = new HashSet<string> (str_hash, str_equal);
        Set<string> includes = new HashSet<string> (str_hash, str_equal);
@@ -36,6 +38,10 @@ public class Vala.CCodeFile {
        CCodeFragment constant_declaration = new CCodeFragment ();
        CCodeFragment type_member_definition = new CCodeFragment ();
 
+       public CCodeFile (SourceFile? source_file = null) {
+               file = source_file;
+       }
+
        public bool add_declaration (string name) {
                if (name in declarations) {
                        return true;
index de0bae8682eb067de111dc8cbea8cd64aa2fbf14..0cb9cf96fd06d32eb6c9721ae91b89725c930119 100644 (file)
@@ -759,7 +759,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public override void visit_source_file (SourceFile source_file) {
-               cfile = new CCodeFile ();
+               cfile = new CCodeFile (source_file);
 
                user_marshal_set = new HashSet<string> (str_hash, str_equal);