[vala] Add another unfortunate CCode ctype alias for type



commit a31a0d1e4a2ae06d2796519cf53f311ff7268f33
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun May 12 21:06:04 2013 +0200

    Add another unfortunate CCode ctype alias for type

 codegen/valaccodeattribute.vala  |   23 ++++++++++++++++++++---
 codegen/valaccodebasemodule.vala |    2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index a4a1614..d11021b 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -255,6 +255,21 @@ public class Vala.CCodeAttribute : AttributeCache {
                }
        }
 
+       public string ctype {
+               get {
+                       if (!ctype_set) {
+                               if (ccode != null) {
+                                       _ctype = ccode.get_string ("type");
+                                       if (_ctype == null) {
+                                               _ctype = ccode.get_string ("ctype");
+                                       }
+                               }
+                               ctype_set = true;
+                       }
+                       return _ctype;
+               }
+       }
+
        public string type_id {
                get {
                        if (_type_id == null) {
@@ -409,9 +424,9 @@ public class Vala.CCodeAttribute : AttributeCache {
                        if (_finish_name == null) {
                                if (ccode != null) {
                                        _finish_name = ccode.get_string ("finish_name");
-                               }
-                               if (_finish_name == null) {
-                                       _finish_name = ccode.get_string ("finish_function");
+                                       if (_finish_name == null) {
+                                               _finish_name = ccode.get_string ("finish_function");
+                                       }
                                }
                                if (_finish_name == null) {
                                        _finish_name = get_finish_name_for_basename (name);
@@ -495,6 +510,8 @@ public class Vala.CCodeAttribute : AttributeCache {
        private string _finish_real_name;
        private string _real_name;
        private string _delegate_target_name;
+       private string _ctype;
+       private bool ctype_set = false;
 
        private static int dynamic_method_id;
 
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0f96e3d..78bfde2 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6187,7 +6187,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public static string? get_ccode_type (CodeNode node) {
-               return node.get_attribute_string ("CCode", "type");
+               return get_ccode_attribute(node).ctype;
        }
 
        public static bool get_ccode_simple_generics (Method m) {


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