summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorMathias Hasselmann <mathias.hasselmann@gmx.de>2007-08-14 20:47:19 +0000
committerMathias Hasselmann <hasselmm@src.gnome.org>2007-08-14 20:47:19 +0000
commit76e1657d04f811934bb2c08d36b48971fed19321 (patch)
tree793485a3d05abd53c47c8508cfe4098e4411bbd8 /vala
parent3933155783fd79ab61f62475318d4deec14281d8 (diff)
downloadvala-76e1657d04f811934bb2c08d36b48971fed19321.tar.gz
generate "throws" clause when needed
2007-08-14 Mathias Hasselmann <mathias.hasselmann@gmx.de> * vala/valainterfacewriter.vala: generate "throws" clause when needed svn path=/trunk/; revision=467
Diffstat (limited to 'vala')
-rw-r--r--vala/valainterfacewriter.vala24
1 files changed, 21 insertions, 3 deletions
diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.vala
index 1ed50f73f..06ea9f08f 100644
--- a/vala/valainterfacewriter.vala
+++ b/vala/valainterfacewriter.vala
@@ -337,9 +337,26 @@ public class Vala.InterfaceWriter : CodeVisitor {
write_newline ();
}
+ private void write_error_domains (Collection<TypeReference> error_domains) {
+ if (error_domains.size > 0) {
+ write_string (" throws ");
+
+ bool first = true;
+ foreach (TypeReference type in error_domains) {
+ if (!first) {
+ write_string (", ");
+ } else {
+ first = false;
+ }
+
+ write_type (type);
+ }
+ }
+ }
+
private void write_params (Collection<FormalParameter> params) {
write_string ("(");
-
+
bool first = true;
foreach (FormalParameter param in params) {
if (!first) {
@@ -373,7 +390,7 @@ public class Vala.InterfaceWriter : CodeVisitor {
write_string (param.default_expression.to_string ());
}
}
-
+
write_string (")");
}
@@ -487,8 +504,9 @@ public class Vala.InterfaceWriter : CodeVisitor {
}
write_string (" ");
-
+
write_params (m.get_parameters ());
+ write_error_domains (m.get_error_domains ());
write_string (";");