]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: use glib macros instead of trying to guess correct names
authorEvan Nemerson <evan@coeus-group.com>
Fri, 4 May 2012 08:43:55 +0000 (01:43 -0700)
committerEvan Nemerson <evan@coeus-group.com>
Sat, 23 Jun 2012 05:14:26 +0000 (22:14 -0700)
Fixes bugs 675433, 673707, and 675364.

codegen/valaccodebasemodule.vala

index 55ea4cc45f4b3075dffcc6405c77dd350ff2405d..769722a404558cc84e5563a7cb28b26c018802af 100644 (file)
@@ -5116,12 +5116,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        var type_domain = new CCodeIdentifier (get_ccode_upper_case_name (et.error_domain));
                        return new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, instance_domain, type_domain);
                } else {
-                       string type_check_func = get_ccode_type_check_function (type.data_type);
-                       if (type_check_func == "") {
+                       string type_id = get_ccode_type_id (type.data_type);
+                       if (type_id == "") {
                                return new CCodeInvalidExpression ();
                        }
-                       var ccheck = new CCodeFunctionCall (new CCodeIdentifier (type_check_func));
+                       var ccheck = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_CHECK_INSTANCE_TYPE"));
                        ccheck.add_argument ((CCodeExpression) ccodenode);
+                       ccheck.add_argument (new CCodeIdentifier (type_id));
                        return ccheck;
                }
        }
@@ -6149,8 +6150,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        public CCodeFunctionCall generate_instance_cast (CCodeExpression expr, TypeSymbol type) {
-               var result = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_upper_case_name (type, null)));
+               var result = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_CHECK_INSTANCE_CAST"));
                result.add_argument (expr);
+               result.add_argument (new CCodeIdentifier (get_ccode_type_id (type)));
+               result.add_argument (new CCodeIdentifier (get_ccode_name (type)));
                return result;
        }