[vala/staging] codegen: Properly handle PointerType/VoidType 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 PointerType/VoidType in get_ccode_lower_case_name()
- Date: Fri, 5 Feb 2016 15:05:40 +0000 (UTC)
commit 27510903a3be8bccee4466b56808b23c149e6f0b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Feb 5 16:05:07 2016 +0100
codegen: Properly handle PointerType/VoidType in get_ccode_lower_case_name()
codegen/valaccodebasemodule.vala | 5 +++++
tests/basic-types/arrays.vala | 9 +++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ae18ce5..2d2632a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6069,8 +6069,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else if (node is DelegateType) {
var type = (DelegateType) node;
return get_ccode_lower_case_name (type.delegate_symbol, infix);
+ } else if (node is PointerType) {
+ var type = (PointerType) node;
+ return get_ccode_lower_case_name (type.base_type, infix);
} else if (node is GenericType) {
return "valageneric";
+ } else if (node is VoidType) {
+ return "valavoid";
} 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 b3a7baf..fece749 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -183,6 +183,14 @@ void test_generics_array () {
assert (b.length == 3);
}
+void test_void_array () {
+ void*[] a = {};
+ a += (void*) null;
+ a += (void*) null;
+ assert (a.length == 2);
+ assert ((void*) null in a);
+}
+
void main () {
test_integer_array ();
test_string_array ();
@@ -193,4 +201,5 @@ void main () {
test_inline_array ();
test_delegate_array ();
test_generics_array ();
+ test_void_array ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]