remove obsolete ref modifier and callback keyword
[vala-lang.git] / vala / valacreationmethod.vala
blob85e1075c3a794dc506fe21fbbb2ab66f7f954a80
1 /* valacreationmethod.vala
3 * Copyright (C) 2007 Raffaele Sandrini
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Raffaele Sandrini <j@bitron.ch>
23 using GLib;
25 /**
26 * Represents a type creation method.
28 public class Vala.CreationMethod : Method {
29 /**
30 * Specifies the number of parameters this creation method sets.
32 public int n_construction_params { get; set; }
34 /**
35 * Creates a new method.
37 * @param name method name
38 * @param source_reference reference to source code
39 * @return newly created method
41 public CreationMethod (construct string name, construct SourceReference source_reference = null) {
44 public override void accept (CodeVisitor! visitor) {
45 visitor.visit_creation_method (this);
48 public override void accept_children (CodeVisitor! visitor) {
49 foreach (FormalParameter param in get_parameters()) {
50 param.accept (visitor);
53 if (body != null) {
54 body.accept (visitor);
58 public override string! get_default_cname () {
59 var parent = symbol.parent_symbol.node;
60 assert (parent is DataType);
61 if (name == null) {
62 return "%snew".printf (((DataType) parent).get_lower_case_cprefix ());
63 } else {
64 return "%snew_%s".printf (((DataType) parent).get_lower_case_cprefix (), name);