Asynchronous creation methods are represented by 5 functions, "*_new",
"*_new_finish", "*_construct", "*_construct_co" and "*_construct_finish".
The argument checks are emitted in "*_construct" which is a void function
and cannot return any value.
Regression of
43f3e2ca534d082433fbe62aa347b7af443f9f33
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1077
cfile.add_include ("glib.h");
var cm = method_node as CreationMethod;
- if (cm != null && cm.parent_symbol is ObjectTypeSymbol) {
+ if (cm != null && !cm.coroutine && cm.parent_symbol is ObjectTypeSymbol) {
ccheck.call = new CCodeIdentifier ("g_return_val_if_fail");
ccheck.add_argument (new CCodeConstant ("NULL"));
} else if (ret_type is VoidType) {
asynchronous/catch-in-finally.vala \
asynchronous/creation-missing-yield.test \
asynchronous/closures.vala \
+ asynchronous/constructor-argument-check.vala \
asynchronous/finish-name.vala \
asynchronous/generator.vala \
asynchronous/out-parameter-invalid.test \
--- /dev/null
+class Foo {
+ public async Foo (string bar) {
+ assert (bar == "foo");
+ }
+}
+
+async void run () {
+ yield new Foo ("foo");
+}
+
+void main () {
+ run.begin ();
+}