diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-09-18 23:30:31 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-09-18 23:45:33 +0200 |
commit | ff0eda52ceb81d9eec68b732d693c85279116349 (patch) | |
tree | 3346c74adc05fcedf1fdc46f53a903a82b60d027 /tests/delegates | |
parent | 0f3cc46f70252127074c040d9e7e1d2233a7c22d (diff) | |
download | vala-ff0eda52ceb81d9eec68b732d693c85279116349.tar.gz |
codegen: Add type declaration for implicit temporary local variable
Diffstat (limited to 'tests/delegates')
-rw-r--r-- | tests/delegates/implicit-local-variable.c-expected | 60 | ||||
-rw-r--r-- | tests/delegates/implicit-local-variable.vala | 6 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/delegates/implicit-local-variable.c-expected b/tests/delegates/implicit-local-variable.c-expected new file mode 100644 index 000000000..f38ba1dca --- /dev/null +++ b/tests/delegates/implicit-local-variable.c-expected @@ -0,0 +1,60 @@ +/* delegates_implicit_local_variable.c generated by valac, the Vala compiler + * generated from delegates_implicit_local_variable.vala, do not modify */ + +#include <glib.h> + +typedef gboolean (*GSourceDispatchFunc) (GSource* source, GSourceFunc _callback, gpointer _callback_target); +#define _g_source_unref0(var) ((var == NULL) ? NULL : (var = (g_source_unref (var), NULL))) + +static void _vala_main (void); +static gboolean __lambda4_ (void); +static gboolean ___lambda4__gsource_dispatch_func (GSource* source, + GSourceFunc _callback, + gpointer _callback_target); + +static gboolean +__lambda4_ (void) +{ + gboolean result = FALSE; + result = FALSE; + return result; +} + +static gboolean +___lambda4__gsource_dispatch_func (GSource* source, + GSourceFunc _callback, + gpointer _callback_target) +{ + gboolean result; + result = __lambda4_ (); + return result; +} + +static void +_vala_main (void) +{ + GSourceFuncs foo = {0}; + GSourceFuncs _tmp0_ = {0}; + GSource* bar = NULL; + GSourceFuncs _tmp1_; + GSourceDispatchFunc _tmp2_; + _tmp0_.prepare = NULL; + _tmp0_.check = NULL; + _tmp0_.dispatch = ___lambda4__gsource_dispatch_func; + _tmp0_.finalize = NULL; + foo = _tmp0_; + bar = NULL; + _tmp1_ = foo; + _tmp2_ = _tmp1_.dispatch; + _tmp2_ (bar, NULL, NULL); + _g_source_unref0 (bar); +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + diff --git a/tests/delegates/implicit-local-variable.vala b/tests/delegates/implicit-local-variable.vala new file mode 100644 index 000000000..ffe1d3175 --- /dev/null +++ b/tests/delegates/implicit-local-variable.vala @@ -0,0 +1,6 @@ +void main () { + SourceFuncs foo = { null, null, () => { return false; }, null }; + Source bar = null; + + foo.dispatch (bar, null); +} |