Commit bea6f324 authored by Mathias Hasselmann's avatar Mathias Hasselmann Committed by Mathias Hasselmann
Browse files

handle null pointer for expression_type in get_implicit_cast_expression.

2007-09-02  Mathias Hasselmann  <mathias.hasselmann@gmx.de>

	* gobject/valacodegenerator.vala, tests/Makefile.am: handle null
	  pointer for expression_type in get_implicit_cast_expression.
	  needed for instance to pass function pointers to HashTable.full
	* tests/test-036.exp, tests/test-036.vala: test for usability
	  of HashTable.full

svn path=/trunk/; revision=574
parent f557ad91
2007-09-02 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* gobject/valacodegenerator.vala, tests/Makefile.am: handle null
pointer for expression_type in get_implicit_cast_expression.
needed for instance to pass function pointers to HashTable.full
* tests/test-036.exp, tests/test-036.vala: test for usability
of HashTable.full
2007-09-02 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* vapigen/Makefile.am, vapigen/valavapicheck.vala: adding vapicheck
......
......@@ -2641,7 +2641,11 @@ public class Vala.CodeGenerator : CodeVisitor {
return result;
}
private CCodeExpression! get_implicit_cast_expression (CCodeExpression! cexpr, TypeReference! expression_type, TypeReference! target_type) {
private CCodeExpression! get_implicit_cast_expression (CCodeExpression! cexpr, TypeReference expression_type, TypeReference! target_type) {
if (null == expression_type) {
return cexpr;
}
if (expression_type.data_type == target_type.data_type) {
// same type, no cast required
return cexpr;
......
......@@ -69,6 +69,7 @@ TESTS = \
test-033.vala \
test-034.vala \
test-035.vala \
test-036.vala \
$(NULL)
EXTRA_DIST = \
......@@ -110,6 +111,7 @@ EXTRA_DIST = \
test-033.exp \
test-034.exp \
test-035.exp \
test-036.exp \
\
testenchant.stamp \
testenchant.vala \
......
testing function pointers: 1 2 3
using GLib;
class Maman.Bar : GLib.Object {
static void main () {
stdout.printf ("testing function pointers:");
var table = new HashTable<string, Bar>.full (str_hash, str_equal, g_free, Object.unref);
stdout.printf (" 1");
table.insert ("foo", new Bar ());
stdout.printf (" 2");
var bar = table.lookup ("foo");
stdout.printf (" 3\n");
}
}
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