FlowAnalyzer is not applied on external subroutines
Since 8f3a0a0b we rely on information gathered by the FlowAnalyzer which has a bad influence on the following source.
Here is a foo.vapi:
namespace Foo {
[CCode (cheader_filename = "foo.h", cname = "struct foobar")]
[SimpleType]
struct Bar {
int x;
int y;
public void get_coords (out int x, out int y) {
x = this.x;
y = this.y;
}
}
}
Here is the main.vala:
public int main (string[] argv) {
Foo.Bar bar = {};
int x, y;
bar.get_coords (out x, out y);
return 0;
}
When looking at the generated C code, the function looks like this:
static void
foo_bar_get_coords (struct foobar self,
gint* x,
gint* y)
{
gint _vala_x = 0;
gint _vala_y = 0;
_vala_x = self.x;
_vala_y = self.y;
}
Note that there is no assignment to *x and *y
If the content of the .vapi was in the .vala file, the result would have been:
void
foo_bar_get_coords (struct foobar self,
gint* x,
gint* y)
{
gint _vala_x = 0;
gint _vala_y = 0;
_vala_x = self.x;
_vala_y = self.y;
if (x) {
*x = _vala_x;
}
if (y) {
*y = _vala_y;
}
}
Edited by Rico Tzschichholz