summaryrefslogtreecommitdiff
path: root/ccode
diff options
context:
space:
mode:
authorJuerg Billeter <j@bitron.ch>2008-01-03 14:50:03 +0000
committerJürg Billeter <juergbi@src.gnome.org>2008-01-03 14:50:03 +0000
commit413648d9914a40a409c44ac160492609fe45c566 (patch)
tree4321bcf006ff354188e9484ecc8b9581bc7e2b03 /ccode
parente340c6aba60e805aec636c24f75338ac8a4be46a (diff)
downloadvala-413648d9914a40a409c44ac160492609fe45c566.tar.gz
add limited support for defining methods with variable argument list
2008-01-03 Juerg Billeter <j@bitron.ch> * gobject/valaccodegenerator.vala, gobject/valaccodegeneratormethod.vala, ccode/valaccodeformalparameter.vala: add limited support for defining methods with variable argument list svn path=/trunk/; revision=800
Diffstat (limited to 'ccode')
-rw-r--r--ccode/valaccodeformalparameter.vala30
1 files changed, 22 insertions, 8 deletions
diff --git a/ccode/valaccodeformalparameter.vala b/ccode/valaccodeformalparameter.vala
index 006ea9c77..307bc9015 100644
--- a/ccode/valaccodeformalparameter.vala
+++ b/ccode/valaccodeformalparameter.vala
@@ -1,6 +1,6 @@
/* valaccodeformalparameter.vala
*
- * Copyright (C) 2006 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
@@ -29,21 +29,35 @@ public class Vala.CCodeFormalParameter : CCodeNode {
/**
* The parameter name.
*/
- public string! name { get; set construct; }
+ public string name { get; set; }
/**
* The parameter type.
*/
- public string! type_name { get; set construct; }
-
+ public string type_name { get; set; }
+
+ /**
+ * Specifies whether the function accepts an indefinite number of
+ * arguments.
+ */
+ public bool ellipsis { get; set; }
+
public CCodeFormalParameter (string! n, string! type) {
name = n;
type_name = type;
}
-
+
+ public CCodeFormalParameter.with_ellipsis () {
+ ellipsis = true;
+ }
+
public override void write (CCodeWriter! writer) {
- writer.write_string (type_name);
- writer.write_string (" ");
- writer.write_string (name);
+ if (!ellipsis) {
+ writer.write_string (type_name);
+ writer.write_string (" ");
+ writer.write_string (name);
+ } else {
+ writer.write_string ("...");
+ }
}
}