Commit 7f6fa27c authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

allow private static fields in interfaces, fixes bug 437435

2007-07-24  Juerg Billeter  <j@bitron.ch>

	* vala/parser.y, vala/valainterface.vala: allow private static fields in
	  interfaces, fixes bug 437435

svn path=/trunk/; revision=379
parent 4542c159
2007-07-24 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/valainterface.vala: allow private static fields in
interfaces, fixes bug 437435
2007-07-23 Jürg Billeter <j@bitron.ch> 2007-07-23 Jürg Billeter <j@bitron.ch>
* vala/valaarray.vala, vala/valaarraylengthfield.vala, * vala/valaarray.vala, vala/valaarraylengthfield.vala,
......
...@@ -3060,6 +3060,14 @@ interface_member_declaration ...@@ -3060,6 +3060,14 @@ interface_member_declaration
g_object_unref ($1); g_object_unref ($1);
} }
} }
| field_declaration
{
/* skip declarations with errors */
if ($1 != NULL) {
vala_interface_add_field (VALA_INTERFACE (symbol_stack->data), $1);
g_object_unref ($1);
}
}
| property_declaration | property_declaration
{ {
/* skip declarations with errors */ /* skip declarations with errors */
......
...@@ -37,6 +37,7 @@ public class Vala.Interface : DataType { ...@@ -37,6 +37,7 @@ public class Vala.Interface : DataType {
private List<TypeReference> prerequisites; private List<TypeReference> prerequisites;
private List<Method> methods; private List<Method> methods;
private List<Field> fields;
private List<Property> properties; private List<Property> properties;
private List<Signal> signals; private List<Signal> signals;
...@@ -135,6 +136,28 @@ public class Vala.Interface : DataType { ...@@ -135,6 +136,28 @@ public class Vala.Interface : DataType {
return methods.copy (); return methods.copy ();
} }
/**
* Adds the specified field as a member to this interface. The field
* must be private and static.
*
* @param f a field
*/
public void add_field (Field! f) {
// non_null fields not yet supported due to initialization issues
f.type_reference.non_null = false;
fields.append (f);
scope.add (f.name, f);
}
/**
* Returns a copy of the list of fields.
*
* @return list of fields
*/
public List<weak Field> get_fields () {
return fields.copy ();
}
/** /**
* Adds the specified property as a member to this interface. * Adds the specified property as a member to this interface.
* *
...@@ -235,6 +258,10 @@ public class Vala.Interface : DataType { ...@@ -235,6 +258,10 @@ public class Vala.Interface : DataType {
m.accept (visitor); m.accept (visitor);
} }
foreach (Field f in fields) {
f.accept (visitor);
}
foreach (Property prop in properties) { foreach (Property prop in properties) {
prop.accept (visitor); prop.accept (visitor);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment