[vala/staging] codegen: Properly handle DelegateType in get_ccode_lower_case_name()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Properly handle DelegateType in get_ccode_lower_case_name()
- Date: Fri, 5 Feb 2016 08:09:18 +0000 (UTC)
commit 31309c72fa8efc14dacd819e9049844470fad567
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Feb 5 09:08:12 2016 +0100
codegen: Properly handle DelegateType in get_ccode_lower_case_name()
codegen/valaccodebasemodule.vala | 3 +++
tests/basic-types/arrays.vala | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0f79235..bd4ecbf 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6066,6 +6066,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else {
return get_ccode_lower_case_name (type.error_code, infix);
}
+ } else if (node is DelegateType) {
+ var type = (DelegateType) node;
+ return get_ccode_lower_case_name (type.delegate_symbol, infix);
} else {
var type = (DataType) node;
return get_ccode_lower_case_name (type.data_type, infix);
diff --git a/tests/basic-types/arrays.vala b/tests/basic-types/arrays.vala
index 00a7164..e9143b4 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -120,6 +120,22 @@ void test_inline_array () {
assert (1 in a);
}
+[CCode (has_target = false)]
+delegate int SimpleFunc ();
+SimpleFunc[] simple_delegates;
+
+int simple_func () {
+ return 0;
+}
+
+void test_delegate_array () {
+ SimpleFunc[] a = {};
+ a = (owned) simple_delegates;
+ a += (SimpleFunc) simple_func;
+ assert (a.length == 1);
+ assert (simple_func in a);
+}
+
void main () {
test_integer_array ();
test_string_array ();
@@ -128,4 +144,5 @@ void main () {
test_reference_transfer ();
test_length_assignment ();
test_inline_array ();
+ test_delegate_array ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]