[vala] codegen: Fix cast from non-array to array
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Fix cast from non-array to array
- Date: Tue, 19 Oct 2010 17:37:28 +0000 (UTC)
commit e9b2ab0fd4cc9c78e4848e33ccb19493a13d15d3
Author: Jürg Billeter <j bitron ch>
Date: Tue Oct 19 19:35:54 2010 +0200
codegen: Fix cast from non-array to array
Array length will be set to -1 as there is no length information
available in this case.
codegen/valaccodebasemodule.vala | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index c970eaf..a1bc699 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4569,6 +4569,12 @@ public class Vala.CCodeBaseModule : CodeGenerator {
for (int dim = 1; dim <= array_type.rank; dim++) {
append_array_size (expr, get_array_length_cexpression (expr.inner, dim));
}
+ } else if (array_type != null) {
+ // cast from non-array to array, set invalid length
+ // required by string.data, e.g.
+ for (int dim = 1; dim <= array_type.rank; dim++) {
+ append_array_size (expr, new CCodeConstant ("-1"));
+ }
}
var innercexpr = get_cvalue (expr.inner);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]