Re: [Vala] Inheriting from GLib.Action




On Mar 5, 2014, at 12:40 AM, Luca Bruno <lethalman88 gmail com> wrote:

Thanks for sharing. The girparser has code for detecting such cases and discard the get_foo for the foo 
property. It's not something that should go in the metadata. Girparser should checked too understand the 
reason why it doesn't discard get_foo in this case.

Thank you for the help. I'm suspicious of the following code snippet in valagirparser.vala starting at line 
920:

prop.set_attribute ("NoAccessorMethod", false);
if (prop.get_accessor != null) {
        var m = getter != null ? getter.symbol as Method : null;
        // ensure getter vfunc if the property is abstract
        if (m != null && (m.is_abstract || m.is_virtual || !prop.is_abstract)) {
                getter.process (parser);
                if (m.return_type is VoidType || m.get_parameters().size != 0) {
                        prop.set_attribute ("NoAccessorMethod", true);
                } else {
                        if (getter.name == name) {
                                foreach (var node in colliding) {
                                        if (node.symbol is Method) {
                                                node.merged = true;
                                        }
                                }
                        }
                        prop.get_accessor.value_type.value_owned = m.return_type.value_owned;
                }
        } else {
                prop.set_attribute ("NoAccessorMethod", true);
        }
}

In the if (getter.name == name), it compares a method name to a property name. In my test case, I get 
("get_enabled" == "enabled"). I added test code and set getter.merged to true, and the vapi output looks 
correct - the getter method is removed. Is this the code that is supposed to remove the getters from the 
vapi? If so, the logic does not seem correct to me.

Cheers,
Ed


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