[Vala] construct block for gtype fundamental classes.



Jurg:

I am glad to come up with the second patch to symmetrize the GObject and
non-compact classes: Bug 562070.

We already have the _constructor function in CCode for GType classes if
there is a construct block, this patch changes the signature of the
function by a little bit, and invokes the _constructor function in
_construct.

A test case is given in the bug report. The nice feature is that If I
change the base class of AAA to GObject, the order in which the
_constructor and CreationMethod are invoked doesn't change.

A drawback is that the CreationMethod of the base class has to be
manifestly invoked, or the construct blocks of the base class is not
invoked. My suggestion for this further use case is to always chain up
to the default base CreationMethod in the vala compiler (instead of
using g_type_instance_new for chained_up == false).

Regards,

Yu






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