2008-02-01 Jürg Billeter <j@bitron.ch>
+ * vala/parser.y, vala/valaproperty.vala, vala/valasemanticanalyzer.vala:
+ report error when declaring static properties
+
+2008-02-01 Jürg Billeter <j@bitron.ch>
+
* vala/valasemanticanalyzer.vala: report error for binary
expressions with invalid operands, fixes bug 513708
if (($4 & VALA_MODIFIER_OVERRIDE) == VALA_MODIFIER_OVERRIDE) {
vala_property_set_overrides ($$, TRUE);
}
+ if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) {
+ vala_property_set_instance ($$, FALSE);
+ }
}
| comment opt_attributes opt_access_modifier opt_modifiers type identifier OPEN_BRACE set_accessor_declaration opt_get_accessor_declaration CLOSE_BRACE
{
if (($4 & VALA_MODIFIER_OVERRIDE) == VALA_MODIFIER_OVERRIDE) {
vala_property_set_overrides ($$, TRUE);
}
+ if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) {
+ vala_property_set_instance ($$, FALSE);
+ }
}
;
/* valaproperty.vala
*
- * Copyright (C) 2006-2007 Jürg Billeter
+ * Copyright (C) 2006-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* property of a base type.
*/
public bool overrides { get; set; }
-
+
+ /**
+ * Specifies whether this field may only be accessed with an instance of
+ * the contained type.
+ */
+ public bool instance {
+ get { return _instance; }
+ set { _instance = value; }
+ }
+
/**
* Specifies the virtual or abstract property this property overrides.
* Reference must be weak as virtual properties set base_property to
private bool lock_used = false;
private DataType _data_type;
+ private bool _instance = true;
/**
* Creates a new property.
public override void visit_property (Property! prop) {
current_symbol = prop;
+ if (!prop.instance) {
+ Report.error (prop.source_reference, "static properties are not yet supported");
+ prop.error = true;
+ return;
+ }
+
prop.accept_children (this);
/* abstract/virtual properties using reference types without