2008-03-02 Jürg Billeter <j@bitron.ch>
+ * gobject/valaccodegenerator.vala: don't free arguments of ref and
+ out parameters
+
+ * tests/classes-methods.vala: test ref parameter
+
+2008-03-02 Jürg Billeter <j@bitron.ch>
+
* tests/testrunner.sh: make sure we detect failed test cases
2008-03-02 Jürg Billeter <j@bitron.ch>
if (b.parent_symbol is Method) {
var m = (Method) b.parent_symbol;
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && !param.type_reference.is_ref && !param.type_reference.is_out) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.type_reference, ma)));
private void append_param_free (Method m, CCodeFragment cfrag) {
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && !param.type_reference.is_ref && !param.type_reference.is_out) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.type_reference, ma)));
bool found = false;
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && !param.type_reference.is_ref && !param.type_reference.is_out) {
found = true;
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
stdout.printf (" 2");
}
+ static void accept_ref_string (ref string str) {
+ }
+
+ static void test_classes_methods_ref_parameters () {
+ string str = "hello";
+ accept_ref_string (ref str);
+ }
+
static int main (string[] args) {
stdout.printf ("Inheritance Test: 1");
stdout.printf (" 3\n");
+ test_classes_methods_ref_parameters ();
+
return 0;
}
}