[vala/switch-to-gir] girparser: Guess array length index from n_param parameters



commit a01768fda5ccb78e40d8319c52962d6bb04bd60c
Author: Luca Bruno <lethalman88 gmail com>
Date:   Fri Aug 27 20:04:07 2010 +0200

    girparser: Guess array length index from n_param parameters

 vala/valagirparser.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 29b96a3..55b024c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1984,6 +1984,17 @@ public class Vala.GirParser : CodeVisitor {
 
 		int last = -1;
 		foreach (MethodInfo info in parameters) {
+			if (info.param.name != null && info.param.name.has_prefix ("n_")) {
+				unowned string array_name = info.param.name.offset (2);
+				// maybe a length for another parameter
+				foreach (var array_info in parameters) {
+					if (array_info.param.name == array_name) {
+						array_info.array_length_idx = i + add;
+						break;
+					}
+				}
+			}
+
 			if (s is Delegate && info.closure_idx == i + add) {
 				var d = (Delegate) s;
 				d.has_target = true;



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