[vala] Support returns_floating_reference attribute for methods



commit 3d7df5b46a7f4f68bca3fc994d90b638c667b4b9
Author: Jürg Billeter <j bitron ch>
Date:   Wed Mar 3 13:58:10 2010 +0100

    Support returns_floating_reference attribute for methods

 vala/valamethod.vala     |    7 ++++++-
 vala/valamethodcall.vala |    5 ++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 4040d37..f98336e 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -1,6 +1,6 @@
 /* valamethod.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
@@ -119,6 +119,8 @@ public class Vala.Method : Member {
 	 */
 	public bool is_inline { get; set; }
 
+	public bool returns_floating_reference { get; set; }
+
 	/**
 	 * Specifies whether the C method returns a new instance pointer which
 	 * may be different from the previous instance pointer. Only valid for
@@ -458,6 +460,9 @@ public class Vala.Method : Member {
 			has_generic_type_parameter = true;
 			generic_type_parameter_position = a.get_double ("generic_type_pos");
 		}
+		if (a.has_argument ("returns_floating_reference")) {
+			returns_floating_reference = a.get_bool ("returns_floating_reference");
+		}
 	}
 	
 	/**
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 10bd8fa..7db46ba 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -1,6 +1,6 @@
 /* valamethodcall.vala
  *
- * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -511,6 +511,9 @@ public class Vala.MethodCall : Expression {
 					add_error_type (call_error_type);
 				}
 			}
+			if (m.returns_floating_reference) {
+				value_type.floating_reference = true;
+			}
 		} else if (mtype is DelegateType) {
 			var d = ((DelegateType) mtype).delegate_symbol;
 			foreach (DataType error_type in d.get_error_types ()) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]