/* valaarraytype.vala
*
- * Copyright (C) 2007-2011 Jürg Billeter
+ * Copyright (C) 2007-2012 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
}
public override string to_qualified_string (Scope? scope) {
- return "%s[%s]%s".printf (element_type.to_qualified_string (scope), string.nfill (rank - 1, ','), nullable ? "?" : "");
+ if (!fixed_length) {
+ return "%s[%s]%s".printf (element_type.to_qualified_string (scope), string.nfill (rank - 1, ','), nullable ? "?" : "");
+ } else {
+ return element_type.to_qualified_string (scope);
+ }
}
public override bool compatible (DataType target_type) {
/* valacodewriter.vala
*
- * Copyright (C) 2006-2010 Jürg Billeter
+ * Copyright (C) 2006-2012 Jürg Billeter
* Copyright (C) 2006-2008 Raffaele Sandrini
*
* This library is free software; you can redistribute it and/or
write_string (" ");
write_identifier (c.name);
+ write_type_suffix (c.type_reference);
if (type == CodeWriterType.FAST && c.value != null) {
write_string(" = ");
c.value.accept (this);
write_string (" ");
write_identifier (f.name);
+ write_type_suffix (f.variable_type);
write_string (";");
write_newline ();
}
write_string (" ");
write_identifier (param.name);
+ write_type_suffix (param.variable_type);
if (param.initializer != null) {
write_string (" = ");
write_type (local.variable_type);
write_string (" ");
write_identifier (local.name);
+ write_type_suffix (local.variable_type);
if (local.initializer != null) {
write_string (" = ");
local.initializer.accept (this);
write_string (type.to_qualified_string (current_scope));
}
+ private void write_type_suffix (DataType type) {
+ var array_type = type as ArrayType;
+ if (array_type != null && array_type.fixed_length) {
+ write_string ("[%d]".printf (array_type.length));
+ }
+ }
+
private void write_string (string s) {
stream.printf ("%s", s);
bol = false;