vala r1096 - in trunk: . gobject tests
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1096 - in trunk: . gobject tests
- Date: Sun, 2 Mar 2008 22:10:37 +0000 (GMT)
Author: juergbi
Date: Sun Mar 2 22:10:37 2008
New Revision: 1096
URL: http://svn.gnome.org/viewvc/vala?rev=1096&view=rev
Log:
2008-03-02 Juerg Billeter <j bitron ch>
* gobject/valaccodegenerator.vala: don't free arguments of ref and
out parameters
* tests/classes-methods.vala: test ref parameter
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/tests/classes-methods.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Sun Mar 2 22:10:37 2008
@@ -916,7 +916,7 @@
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)));
@@ -1936,7 +1936,7 @@
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)));
@@ -1981,7 +1981,7 @@
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;
Modified: trunk/tests/classes-methods.vala
==============================================================================
--- trunk/tests/classes-methods.vala (original)
+++ trunk/tests/classes-methods.vala Sun Mar 2 22:10:37 2008
@@ -19,6 +19,14 @@
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");
@@ -48,6 +56,8 @@
stdout.printf (" 3\n");
+ test_classes_methods_ref_parameters ();
+
return 0;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]