Commit 36d058f0 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

fix properties with interface types fix memory management when storing

2007-03-21  Jürg Billeter  <j@bitron.ch>

	* vala/valacodegenerator.vala: fix properties with interface types
	* vala/valamemorymanager.vala: fix memory management when storing array
	  elements
	* vala/valaconstant.vala: obey overridden cprefix in namespaces
	* vapi/config.vala: override lower_case_cprefix of namespace

svn path=/trunk/; revision=260
parent 5ca8eee4
2007-03-21 Jürg Billeter <j@bitron.ch>
* vala/valacodegenerator.vala: fix properties with interface types
* vala/valamemorymanager.vala: fix memory management when storing array
elements
* vala/valaconstant.vala: obey overridden cprefix in namespaces
* vapi/config.vala: override lower_case_cprefix of namespace
2007-03-21 Raffaele Sandrini <rasa@gmx.ch>
* vala/valaconstant.vala: add '_' between namespace and name of
......
......@@ -779,7 +779,7 @@ public class Vala.CodeGenerator : CodeVisitor {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_set_%s".printf (prefix, prop.name)));
ccall.add_argument (new CCodeIdentifier ("self"));
var cgetcall = new CCodeFunctionCall ();
if (prop.type_reference.data_type is Class) {
if (prop.type_reference.data_type is Class || prop.type_reference.data_type is Interface) {
cgetcall.call = new CCodeIdentifier ("g_value_get_object");
} else if (prop.type_reference.type_name == "string") {
cgetcall.call = new CCodeIdentifier ("g_value_get_string");
......@@ -882,7 +882,7 @@ public class Vala.CodeGenerator : CodeVisitor {
cspec.add_argument (prop.get_canonical_cconstant ());
cspec.add_argument (new CCodeConstant ("\"foo\""));
cspec.add_argument (new CCodeConstant ("\"bar\""));
if (prop.type_reference.data_type is Class) {
if (prop.type_reference.data_type is Class || prop.type_reference.data_type is Interface) {
cspec.call = new CCodeIdentifier ("g_param_spec_object");
cspec.add_argument (new CCodeIdentifier (prop.type_reference.data_type.get_upper_case_cname ("TYPE_")));
} else if (prop.type_reference.data_type == string_type.data_type) {
......@@ -1851,7 +1851,7 @@ public class Vala.CodeGenerator : CodeVisitor {
CCodeFunctionCall set_fc;
if (sig.return_type.type_parameter != null) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_pointer"));
} else if (sig.return_type.data_type is Class) {
} else if (sig.return_type.data_type is Class || sig.return_type.data_type is Interface) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_object"));
} else if (sig.return_type.data_type == string_type.data_type) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_string"));
......
......@@ -90,14 +90,14 @@ public class Vala.Constant : Member, Lockable {
if (cname == null) {
if (symbol.parent_symbol.node is DataType) {
var t = (DataType) symbol.parent_symbol.node;
cname = "%s_%s".printf (t.get_upper_case_cname (null), name);
cname = "%s%s".printf (t.get_lower_case_cprefix ().up (), name);
} else {
var ns = (Namespace) symbol.parent_symbol.node;
if (ns == null) {
// global constant
cname = name;
} else {
cname = "%s_%s".printf (ns.get_cprefix ().up (), name);
cname = "%s%s".printf (ns.get_lower_case_cprefix ().up (), name);
}
}
}
......
......@@ -240,7 +240,7 @@ public class Vala.MemoryManager : CodeVisitor {
}
public override void visit_end_assignment (Assignment! a) {
if (a.left is PointerIndirection || a.left is ElementAccess || a.left.symbol_reference.node is Signal) {
if (a.left is PointerIndirection || (a.left.symbol_reference != null && a.left.symbol_reference.node is Signal)) {
} else {
if (a.left.static_type.takes_ownership) {
visit_possibly_missing_copy_expression (a.right);
......
/* config.vala
*
* Copyright (C) 2006 Jürg Billeter
* Copyright (C) 2006-2007 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
......@@ -20,7 +20,7 @@
* Jürg Billeter <j@bitron.ch>
*/
[CCode (cprefix = "", cheader_filename = "config.h")]
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config {
public const string PACKAGE_VERSION;
public const string PACKAGE_DATADIR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment