diff options
-rw-r--r-- | codegen/valaccodememberaccessmodule.vala | 6 | ||||
-rw-r--r-- | tests/delegates/params-array-with-throws.c-expected | 4 | ||||
-rw-r--r-- | tests/delegates/params-array.c-expected | 10 | ||||
-rw-r--r-- | tests/delegates/variadic.c-expected | 10 |
4 files changed, 18 insertions, 12 deletions
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala index 774377752..29d025142 100644 --- a/codegen/valaccodememberaccessmodule.vala +++ b/codegen/valaccodememberaccessmodule.vala @@ -90,6 +90,12 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { set_cvalue (expr, new CCodeIdentifier (get_ccode_name (m))); } + delegate_type = expr.target_type as DelegateType; + if (delegate_type != null) { + generate_type_declaration (delegate_type, cfile); + set_cvalue (expr, new CCodeCastExpression (get_cvalue (expr), get_ccode_name (delegate_type.delegate_symbol))); + } + set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL")); if (m.binding == MemberBinding.STATIC) { set_delegate_target (expr, new CCodeConstant ("NULL")); diff --git a/tests/delegates/params-array-with-throws.c-expected b/tests/delegates/params-array-with-throws.c-expected index f3734d7f9..7c35f290f 100644 --- a/tests/delegates/params-array-with-throws.c-expected +++ b/tests/delegates/params-array-with-throws.c-expected @@ -173,7 +173,7 @@ _vala_main (void) GError* _inner_error0_ = NULL; { FooFunc func = NULL; - func = foo; + func = (FooFunc) foo; func (&_inner_error0_, "foo", "bar", "manam", NULL); if (G_UNLIKELY (_inner_error0_ != NULL)) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); @@ -183,7 +183,7 @@ _vala_main (void) } { FooFunc func = NULL; - func = bar; + func = (FooFunc) bar; { FooFunc _tmp0_; _tmp0_ = func; diff --git a/tests/delegates/params-array.c-expected b/tests/delegates/params-array.c-expected index 339c072a0..b41164b6e 100644 --- a/tests/delegates/params-array.c-expected +++ b/tests/delegates/params-array.c-expected @@ -349,12 +349,12 @@ _vala_main (void) { { FooFunc func = NULL; - func = foo; + func = (FooFunc) foo; func ("foo", "bar", "manam", NULL); } { BarFunc func = NULL; - func = bar; + func = (BarFunc) bar; func (23, 42, 4711, NULL); } { @@ -362,7 +362,7 @@ _vala_main (void) GValue* _tmp0_ = NULL; GValue* _tmp1_ = NULL; GValue* _tmp2_ = NULL; - func = manam; + func = (ManamFunc) manam; _tmp0_ = g_new0 (GValue, 1); g_value_init (_tmp0_, G_TYPE_STRING); g_value_set_string (_tmp0_, "foo"); @@ -382,7 +382,7 @@ _vala_main (void) GValue* _tmp3_ = NULL; GValue* _tmp4_ = NULL; GValue* _tmp5_ = NULL; - func = manam_owned; + func = (ManamOwnedFunc) manam_owned; _tmp3_ = g_new0 (GValue, 1); g_value_init (_tmp3_, G_TYPE_STRING); g_value_set_string (_tmp3_, "foo"); @@ -399,7 +399,7 @@ _vala_main (void) GVariant* _tmp6_; GVariant* _tmp7_; GVariant* _tmp8_; - func = minim; + func = (MinimFunc) minim; _tmp6_ = _variant_new1 ("foo"); _tmp7_ = _variant_new2 (4711); _tmp8_ = _variant_new3 (3.1415); diff --git a/tests/delegates/variadic.c-expected b/tests/delegates/variadic.c-expected index 7df1cf3ff..cb3a55b50 100644 --- a/tests/delegates/variadic.c-expected +++ b/tests/delegates/variadic.c-expected @@ -151,13 +151,13 @@ _vala_main (void) GError* _inner_error0_ = NULL; { FooFunc func = NULL; - func = foo; + func = (FooFunc) foo; func ("foo", 42, "bar", NULL); } { FooFunc func = NULL; BarFunc f = NULL; - func = foo; + func = (FooFunc) foo; f = func; } { @@ -168,7 +168,7 @@ _vala_main (void) } { BazFunc func = NULL; - func = baz; + func = (BazFunc) baz; func ("baz", &_inner_error0_, 23, "bar", NULL); if (G_UNLIKELY (_inner_error0_ != NULL)) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); @@ -178,7 +178,7 @@ _vala_main (void) } { BazFunc func = NULL; - func = baz_fail; + func = (BazFunc) baz_fail; { BazFunc _tmp0_; _tmp0_ = func; @@ -210,7 +210,7 @@ _vala_main (void) } } { - mamam (foo); + mamam ((FooFunc) foo); } { mamam ((FooFunc) foo); |