vala r1042 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1042 - in trunk: . vala
- Date: Sun, 24 Feb 2008 09:00:51 +0000 (GMT)
Author: juergbi
Date: Sun Feb 24 09:00:50 2008
New Revision: 1042
URL: http://svn.gnome.org/viewvc/vala?rev=1042&view=rev
Log:
2008-02-24 Juerg Billeter <j bitron ch>
* vala/parser.y, vala/valaclass.vala, vala/valainterface.vala:
support inner delegates
Modified:
trunk/ChangeLog
trunk/vala/parser.y
trunk/vala/valaclass.vala
trunk/vala/valainterface.vala
Modified: trunk/vala/parser.y
==============================================================================
--- trunk/vala/parser.y (original)
+++ trunk/vala/parser.y Sun Feb 24 09:00:50 2008
@@ -2964,6 +2964,7 @@
| class_declaration
| struct_declaration
| enum_declaration
+ | delegate_declaration
;
constant_declaration
@@ -3933,6 +3934,7 @@
| class_declaration
| struct_declaration
| enum_declaration
+ | delegate_declaration
;
enum_declaration
@@ -4200,8 +4202,16 @@
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) {
Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala (original)
+++ trunk/vala/valaclass.vala Sun Feb 24 09:00:50 2008
@@ -83,7 +83,8 @@
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.
*/
@@ -325,6 +326,16 @@
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);
}
@@ -377,6 +388,10 @@
foreach (Enum en in enums) {
en.accept (visitor);
}
+
+ foreach (Delegate d in delegates) {
+ d.accept (visitor);
+ }
}
public override string! get_cprefix () {
Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala (original)
+++ trunk/vala/valainterface.vala Sun Feb 24 09:00:50 2008
@@ -48,6 +48,7 @@
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;
@@ -237,6 +238,16 @@
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);
@@ -332,6 +343,10 @@
foreach (Enum en in enums) {
en.accept (visitor);
}
+
+ foreach (Delegate d in delegates) {
+ d.accept (visitor);
+ }
}
public override bool is_reference_type () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]