summaryrefslogtreecommitdiff
path: root/ccode/valaccodefunction.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-08-14 13:04:55 +0200
committerJürg Billeter <j@bitron.ch>2010-09-09 16:23:28 +0200
commiteebec1fdd5d5e27f6dcb68c6e76615736e4bffb1 (patch)
tree4f0bb80b0e2aa2eb46de4c3f54bd7ca4dc593839 /ccode/valaccodefunction.vala
parent548b6d6ef3f5fa84acdcfaf15877008c3fb76040 (diff)
downloadvala-eebec1fdd5d5e27f6dcb68c6e76615736e4bffb1.tar.gz
Add CCodeFile.add_function_declaration and CCodeFunction.is_declaration
Diffstat (limited to 'ccode/valaccodefunction.vala')
-rw-r--r--ccode/valaccodefunction.vala8
1 files changed, 6 insertions, 2 deletions
diff --git a/ccode/valaccodefunction.vala b/ccode/valaccodefunction.vala
index d414fb28b..bf7071f8d 100644
--- a/ccode/valaccodefunction.vala
+++ b/ccode/valaccodefunction.vala
@@ -43,16 +43,19 @@ public class Vala.CCodeFunction : CCodeNode {
public string attributes { get; set; }
+ public bool is_declaration { get; set; }
+
/**
* The function body.
*/
public CCodeBlock block { get; set; }
private List<CCodeFormalParameter> parameters = new ArrayList<CCodeFormalParameter> ();
-
+
public CCodeFunction (string name, string return_type = "void") {
this.name = name;
this.return_type = return_type;
+ this.block = new CCodeBlock ();
}
/**
@@ -85,6 +88,7 @@ public class Vala.CCodeFunction : CCodeNode {
func.parameters.add (param);
}
+ func.is_declaration = is_declaration;
func.block = block;
return func;
}
@@ -121,7 +125,7 @@ public class Vala.CCodeFunction : CCodeNode {
writer.write_string (" G_GNUC_DEPRECATED");
}
- if (block == null) {
+ if (is_declaration) {
if (attributes != null) {
writer.write_string (" ");
writer.write_string (attributes);