]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add CodeContext.check method
authorJürg Billeter <j@bitron.ch>
Thu, 28 Oct 2010 11:34:13 +0000 (13:34 +0200)
committerJürg Billeter <j@bitron.ch>
Thu, 28 Oct 2010 14:20:17 +0000 (16:20 +0200)
compiler/valacompiler.vala
vala/valacodecontext.vala
vapigen/valavapigen.vala

index 33106041516ff5e68350aa3eb117787761f58656..772ed94a017baeaafae7f35226390f2e122e2d43 100644 (file)
@@ -343,17 +343,13 @@ class Vala.Compiler {
                        interface_writer.write_file (context, fast_vapi_filename);
                        return quit ();
                }
-               
-               var resolver = new SymbolResolver ();
-               resolver.resolve (context);
-               
+
+               context.check ();
+
                if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
                        return quit ();
                }
 
-               var analyzer = new SemanticAnalyzer ();
-               analyzer.analyze (context);
-
                if (!ccode_only && !compile_only && library == null) {
                        // building program, require entry point
                        if (!has_c_files && context.entry_point == null) {
@@ -370,13 +366,6 @@ class Vala.Compiler {
                        return quit ();
                }
 
-               var flow_analyzer = new FlowAnalyzer ();
-               flow_analyzer.analyze (context);
-
-               if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
-                       return quit ();
-               }
-
                context.codegen.emit (context);
 
                if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
index 5d3b02284f9fb2c67f84f3f550970792b887943a..cfb0a9bbc23b5b64044c22121c2ad840c52b08ae 100644 (file)
@@ -200,12 +200,21 @@ public class Vala.CodeContext {
                get { return _root; }
        }
 
+       public SymbolResolver resolver { get; private set; }
+
+       public SemanticAnalyzer analyzer { get; private set; }
+
+       public FlowAnalyzer flow_analyzer { get; private set; }
+
        /**
         * The selected code generator.
         */
        public CodeGenerator codegen { get; set; }
 
        public CodeContext () {
+               resolver = new SymbolResolver ();
+               analyzer = new SemanticAnalyzer ();
+               flow_analyzer = new FlowAnalyzer ();
        }
 
        /**
@@ -444,6 +453,25 @@ public class Vala.CodeContext {
                }
        }
 
+       /**
+        * Resolve and analyze.
+        */
+       public void check () {
+               resolver.resolve (this);
+
+               if (report.get_errors () > 0) {
+                       return;
+               }
+
+               analyzer.analyze (this);
+
+               if (report.get_errors () > 0) {
+                       return;
+               }
+
+               flow_analyzer.analyze (this);
+       }
+
        public void add_define (string define) {
                defines.add (define);
        }
index 32bbb25a6a36da053b662f0eedcee05ae2143dc7..a5cc9234f4a3258bad36f32ef16aedda3aa8eb00 100644 (file)
@@ -150,19 +150,11 @@ class Vala.VAPIGen : Object {
                var gidlparser = new GIdlParser ();
                gidlparser.parse (context);
                
-               if (context.report.get_errors () > 0) {
-                       return quit ();
-               }
-               
-               var resolver = new SymbolResolver ();
-               resolver.resolve (context);
-               
                if (context.report.get_errors () > 0) {
                        return quit ();
                }
 
-               var analyzer = new SemanticAnalyzer ();
-               analyzer.analyze (context);
+               context.check ();
 
                if (context.report.get_errors () > 0) {
                        return quit ();