From 413648d9914a40a409c44ac160492609fe45c566 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Thu, 3 Jan 2008 14:50:03 +0000 Subject: add limited support for defining methods with variable argument list 2008-01-03 Juerg Billeter * gobject/valaccodegenerator.vala, gobject/valaccodegeneratormethod.vala, ccode/valaccodeformalparameter.vala: add limited support for defining methods with variable argument list svn path=/trunk/; revision=800 --- ccode/valaccodeformalparameter.vala | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'ccode') 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 ("..."); + } } } -- cgit v1.2.1