+2008-09-27 Jürg Billeter <j@bitron.ch>
+
+ * vala/valaparser.vala:
+ * vala/valasemanticanalyzer.vala:
+ * gobject/valaccodegenerator.vala:
+ * gobject/valaccodememberaccessbinding.vala:
+
+ Add basic support for static properties
+
2008-09-27 Jared Moore <jaredm@gmx.com>
* vala/valaenum.vala:
next_temp_var_id = old_next_temp_var_id;
var cl = prop.parent_symbol as Class;
- if (cl != null && cl.is_subtype_of (gobject_type)) {
+ if (cl != null && cl.is_subtype_of (gobject_type)
+ && prop.binding == MemberBinding.INSTANCE) {
// GObject property
// FIXME: omit real struct types for now since they
// cannot be expressed as gobject property yet
}
ObjectType base_type = null;
- if (is_virtual) {
- if (prop.base_property != null) {
- base_type = new ObjectType ((ObjectTypeSymbol) prop.base_property.parent_symbol);
- } else if (prop.base_interface_property != null) {
- base_type = new ObjectType ((ObjectTypeSymbol) prop.base_interface_property.parent_symbol);
+ if (prop.binding == MemberBinding.INSTANCE) {
+ if (is_virtual) {
+ if (prop.base_property != null) {
+ base_type = new ObjectType ((ObjectTypeSymbol) prop.base_property.parent_symbol);
+ } else if (prop.base_interface_property != null) {
+ base_type = new ObjectType ((ObjectTypeSymbol) prop.base_interface_property.parent_symbol);
+ }
+ function.modifiers |= CCodeModifiers.STATIC;
+ function.add_parameter (new CCodeFormalParameter ("base", base_type.get_cname ()));
+ } else {
+ function.add_parameter (cselfparam);
}
- function.modifiers |= CCodeModifiers.STATIC;
- function.add_parameter (new CCodeFormalParameter ("base", base_type.get_cname ()));
- } else {
- function.add_parameter (cselfparam);
}
if (returns_real_struct) {
// return non simple structs as out parameter
function.block.prepend_statement (cdecl);
}
- if (!is_virtual) {
+ if (prop.binding == MemberBinding.INSTANCE && !is_virtual) {
if (returns_real_struct) {
function.block.prepend_statement (create_property_type_check_statement (prop, false, t, true, "self"));
} else {
var ccall = new CCodeFunctionCall (new CCodeIdentifier (set_func));
- /* target instance is first argument */
- ccall.add_argument ((CCodeExpression) ma.inner.ccodenode);
+ if (prop.binding == MemberBinding.INSTANCE) {
+ /* target instance is first argument */
+ ccall.add_argument ((CCodeExpression) ma.inner.ccodenode);
+ }
if (prop.no_accessor_method) {
/* property name is second argument of g_object_set */
var prop = new Property (id, type, null, null, get_src_com (begin));
prop.access = access;
set_attributes (prop, attrs);
+ if (ModifierFlags.STATIC in flags) {
+ prop.binding = MemberBinding.STATIC;
+ } else if (ModifierFlags.CLASS in flags) {
+ prop.binding = MemberBinding.CLASS;
+ }
if (ModifierFlags.ABSTRACT in flags) {
prop.is_abstract = true;
}