[vala/0.34] codegen: Default to void-return for vfunc pointer cast of *_async methods



commit f97ec8601f747ea0005be7bb374790ef24092e0a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Feb 28 18:40:59 2017 +0100

    codegen: Default to void-return for vfunc pointer cast of *_async methods
    
    This make it match vala's generated code of async-module.
    
    To properly account for non-void *_async methods we require some additional
    metadata since only the return-type of *_finish method is known.

 codegen/valagtypemodule.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 0398163..1e1b9e3 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1489,7 +1489,7 @@ public class Vala.GTypeModule : GErrorModule {
        CCodeExpression cast_method_pointer (Method m, CCodeExpression cfunc, ObjectTypeSymbol base_type, int 
direction = 3) {
                // Cast the function pointer to match the interface
                string cast;
-               if (m.return_type.is_real_non_null_struct_type ()) {
+               if (direction == 1 || m.return_type.is_real_non_null_struct_type ()) {
                        cast = "void (*)";
                } else {
                        cast = get_ccode_name (m.return_type) + " (*)";


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