[vala/wip/transform: 346/373] Visit all nodes for transformation, not only the source ones



commit 920589f036d6d544b7f7aa31abaae4e982c369fc
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Feb 1 10:22:41 2014 +0100

    Visit all nodes for transformation, not only the source ones

 codegen/valaccodetransformer.vala | 6 +++++-
 vala/valacodetransformer.vala     | 9 +++------
 vala/valaelementaccess.vala       | 2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index 8e28b1f97..b63c20211 100644
--- a/codegen/valaccodetransformer.vala
+++ b/codegen/valaccodetransformer.vala
@@ -70,6 +70,10 @@ public class Vala.CCodeTransformer : CodeTransformer {
        }
 
        public override void visit_method (Method m) {
+               if (m.body == null) {
+                       return;
+               }
+
                m.accept_children (this);
        }
 
@@ -421,7 +425,7 @@ public class Vala.CCodeTransformer : CodeTransformer {
 
                Expression replacement = null;
                var old_parent_node = expr.parent_node;
-               var target_type = expr.target_type != null ? expr.target_type.copy () : null;
+               var target_type = copy_type (expr.target_type);
                push_builder (new CodeBuilder (context, parent_statement, expr.source_reference));
 
                if (context.analyzer.get_current_non_local_symbol (expr) is Block
diff --git a/vala/valacodetransformer.vala b/vala/valacodetransformer.vala
index 86e3a2d01..3e9f6ffae 100644
--- a/vala/valacodetransformer.vala
+++ b/vala/valacodetransformer.vala
@@ -54,12 +54,9 @@ public class Vala.CodeTransformer : CodeVisitor {
                /* we're only interested in non-pkg source files */
                var source_files = context.get_source_files ();
                foreach (SourceFile file in source_files) {
-                       if (file.file_type == SourceFileType.SOURCE ||
-                           (context.header_filename != null && file.file_type == SourceFileType.FAST)) {
-                               /* clear wrapper cache for every file */
-                               wrapper_cache = new HashMap<string, CodeNode> (str_hash, str_equal);
-                               file.accept (this);
-                       }
+                       /* clear wrapper cache for every file */
+                       wrapper_cache = new HashMap<string, CodeNode> (str_hash, str_equal);
+                       file.accept (this);
                }
        }
 
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 5a9fb3199..154ffd5f0 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -76,7 +76,7 @@ public class Vala.ElementAccess : Expression {
        }
 
        public override string to_string () {
-               var s = "%s[";
+               var s = "%s[".printf (container.to_string ());
                bool first = true;
                foreach (var index in indices) {
                        if (first) {


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