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



commit c60d366c920c84fc6f97d629ff715e42be2bbf3e
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 +-
 vala/valamethod.vala              |    2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodetransformer.vala b/codegen/valaccodetransformer.vala
index 8e28b1f..0f286fc 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 8fa8edd..23b10fd 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 947ee65..9d2afc6 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) {
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 237899b..34b6faa 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -663,7 +663,7 @@ public class Vala.Method : Subroutine, Callable {
                if (checked) {
                        return !error;
                }
-
+               
                checked = true;
 
                if (get_attribute ("DestroysInstance") != null) {


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