On Thu, 2009-06-25 at 18:19 +0200, Jürg Billeter wrote: > On Thu, 2009-06-25 at 16:09 +0800, Yu Feng wrote: > > Refer to Sam's email on Jun 24th Switch statement on GType. > > The reason why GType is not supported in switch statements is because > typeof expressions are not considered constant expressions. While there > are a few basic GTypes that are constants in C, this is not true for > types defined outside GLib. > No. The reason why GType is not supported, is because of valaswitchstatement.vala:109, the IntegerType check. No const/non-const check is performed at all.
> If we apply your patch, valac will generate invalid C code if you use > typeof expressions that are not constant in C. > Thus a different issue is involved. We can fix the wrong binding then fix the invalid C-code. I assume each symbol already has a flag specifying if it is const or not(correct me if i am wrong) Then the check should be simple. After the check we can steal the 'if-else' chain in visit_string_switch_statement to make a fix. Regards, Yu > Jürg > _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
