summaryrefslogtreecommitdiff
path: root/ccode/valaccodefunction.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2017-03-09 13:39:10 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2017-11-19 13:05:49 +0100
commit3019b67eaf8da1a0df1519a4728eed1165b12c33 (patch)
treed3dfce1e402d03a4b1d6559c12c8899fffc485c6 /ccode/valaccodefunction.vala
parent62889306e8c47670f3977cb168c8eb1322eb0057 (diff)
downloadvala-3019b67eaf8da1a0df1519a4728eed1165b12c33.tar.gz
ccode: Reformat function declaration and definition for better readability
https://bugzilla.gnome.org/show_bug.cgi?id=688447
Diffstat (limited to 'ccode/valaccodefunction.vala')
-rw-r--r--ccode/valaccodefunction.vala10
1 files changed, 9 insertions, 1 deletions
diff --git a/ccode/valaccodefunction.vala b/ccode/valaccodefunction.vala
index 91addcd8a..8ef10bb1a 100644
--- a/ccode/valaccodefunction.vala
+++ b/ccode/valaccodefunction.vala
@@ -118,9 +118,14 @@ public class Vala.CCodeFunction : CCodeNode {
writer.write_string ("inline ");
}
writer.write_string (return_type);
- writer.write_string (" ");
+ if (is_declaration) {
+ writer.write_string (" ");
+ } else {
+ writer.write_newline ();
+ }
writer.write_string (name);
writer.write_string (" (");
+ int param_pos_begin = (is_declaration ? return_type.char_count () + 1 : 0 ) + name.char_count () + 2;
bool has_args = (CCodeModifiers.PRINTF in modifiers || CCodeModifiers.SCANF in modifiers);
int i = 0;
@@ -129,6 +134,8 @@ public class Vala.CCodeFunction : CCodeNode {
foreach (CCodeParameter param in parameters) {
if (i > 0) {
writer.write_string (", ");
+ writer.write_newline ();
+ writer.write_nspaces (param_pos_begin);
}
param.write (writer);
if (CCodeModifiers.FORMAT_ARG in param.modifiers) {
@@ -177,6 +184,7 @@ public class Vala.CCodeFunction : CCodeNode {
writer.write_string (";");
} else {
+ writer.write_newline ();
block.write (writer);
writer.write_newline ();
}