GNOME Bugzilla – Bug 620120
'this' modification shouldn't be allowed
Last modified: 2010-06-20 19:02:14 UTC
Here's an example (in a modifed glib-2.0.vapi) adding a toggle() method that modifies a local variable. This takes no sense, so the compiler shouldnt permit this. In non-simpletypes 'this' is a pointer and shouldnt be modified. This bug has been discussed in mailing list with the thread subjected as: "[Vala] modify simpletype with methods in vapi" [SimpleType] [CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN", get _value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE", type_signatu re = "b")] [BooleanType] public struct bool { public bool toggle() { this = !this; return this; } }
Created attachment 162520 [details] [review] do not support assigning to this
commit 53489642779c5647eb9980dc78385e37fbb750a2 Author: Luca Bruno <lethalman88@gmail.com> Date: Wed Jun 2 11:11:03 2010 +0200 Do not support assigning to `this' Fixes bug 620120.