+2008-02-24 Jürg Billeter <j@bitron.ch>
+
+ * vala/parser.y, vala/valaclass.vala, vala/valainterface.vala:
+ support inner delegates
+
2008-02-23 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/valaclass.vala, vala/valainterface.vala:
| class_declaration
| struct_declaration
| enum_declaration
+ | delegate_declaration
;
constant_declaration
| class_declaration
| struct_declaration
| enum_declaration
+ | delegate_declaration
;
enum_declaration
g_object_unref ($6);
g_object_unref (src);
- vala_namespace_add_delegate (VALA_NAMESPACE (parent_symbol), cb);
- vala_source_file_add_node (current_source_file, VALA_CODE_NODE (cb));
+ if (VALA_IS_CLASS (parent_symbol)) {
+ vala_class_add_delegate (VALA_CLASS (parent_symbol), cb);
+ } else if (VALA_IS_INTERFACE (parent_symbol)) {
+ vala_interface_add_delegate (VALA_INTERFACE (parent_symbol), cb);
+ } else if (VALA_IS_NAMESPACE (parent_symbol)) {
+ vala_namespace_add_delegate (VALA_NAMESPACE (parent_symbol), cb);
+ vala_source_file_add_node (current_source_file, VALA_CODE_NODE (cb));
+ } else {
+ g_assert_not_reached ();
+ }
g_object_unref (parent_symbol);
if ($3 != -1) {
private Gee.List<Class> classes = new ArrayList<Class> ();
private Gee.List<Struct> structs = new ArrayList<Struct> ();
private Gee.List<Enum> enums = new ArrayList<Enum> ();
-
+ private Gee.List<Delegate> delegates = new ArrayList<Delegate> ();
+
/**
* Specifies the default construction method.
*/
scope.add (en.name, en);
}
+ /**
+ * Adds the specified delegate as an inner delegate.
+ *
+ * @param d a delegate
+ */
+ public void add_delegate (Delegate! d) {
+ delegates.add (d);
+ scope.add (d.name, d);
+ }
+
public override void accept (CodeVisitor! visitor) {
visitor.visit_class (this);
}
foreach (Enum en in enums) {
en.accept (visitor);
}
+
+ foreach (Delegate d in delegates) {
+ d.accept (visitor);
+ }
}
public override string! get_cprefix () {
private Gee.List<Class> classes = new ArrayList<Class> ();
private Gee.List<Struct> structs = new ArrayList<Struct> ();
private Gee.List<Enum> enums = new ArrayList<Enum> ();
+ private Gee.List<Delegate> delegates = new ArrayList<Delegate> ();
private string cname;
private string lower_case_csuffix;
scope.add (en.name, en);
}
+ /**
+ * Adds the specified delegate as an inner delegate.
+ *
+ * @param d a delegate
+ */
+ public void add_delegate (Delegate! d) {
+ delegates.add (d);
+ scope.add (d.name, d);
+ }
+
public override string get_cname (bool const_type = false) {
if (cname == null) {
cname = "%s%s".printf (parent_symbol.get_cprefix (), name);
foreach (Enum en in enums) {
en.accept (visitor);
}
+
+ foreach (Delegate d in delegates) {
+ d.accept (visitor);
+ }
}
public override bool is_reference_type () {