[vala] codegen: Cast return values if [CCode (type)] is supplied



commit 0d97c98734a8ad3504b114e55ccf8330ebaa4423
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri May 10 21:47:19 2013 +0200

    codegen: Cast return values if [CCode (type)] is supplied
    
    Patch by avi w levy gmail com
    
    Fixes bug 699956.

 codegen/valaccodemethodcallmodule.vala |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 8cb1171..6bc87cb 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -714,6 +714,11 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        }
                }
 
+               if (get_ccode_type (m) != null && get_ccode_type (m) != get_ccode_name (m.return_type)) {
+                       // Bug 699956: Implement cast for method return type if [CCode type=] annotation is 
specified
+                       ccall_expr = new CCodeCastExpression (ccall_expr, get_ccode_name (m.return_type));
+               }
+
                if (m is ArrayResizeMethod) {
                        // FIXME: size expression must not be evaluated twice at runtime (potential side 
effects)
                        Iterator<Expression> arg_it = expr.get_argument_list ().iterator ();


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