diff options
author | Jürg Billeter <j@bitron.ch> | 2010-08-14 13:04:55 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2010-09-09 16:23:28 +0200 |
commit | eebec1fdd5d5e27f6dcb68c6e76615736e4bffb1 (patch) | |
tree | 4f0bb80b0e2aa2eb46de4c3f54bd7ca4dc593839 /ccode/valaccodefunction.vala | |
parent | 548b6d6ef3f5fa84acdcfaf15877008c3fb76040 (diff) | |
download | vala-eebec1fdd5d5e27f6dcb68c6e76615736e4bffb1.tar.gz |
Add CCodeFile.add_function_declaration and CCodeFunction.is_declaration
Diffstat (limited to 'ccode/valaccodefunction.vala')
-rw-r--r-- | ccode/valaccodefunction.vala | 8 |
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); |