[vala] Fix calling methods returning structs and throwing errors
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Fix calling methods returning structs and throwing errors
- Date: Sat, 26 Sep 2009 12:47:37 +0000 (UTC)
commit 4de54ba6fd5796bf7ace662faa7ce63cabe429f7
Author: Jürg Billeter <j bitron ch>
Date: Sat Sep 26 14:44:52 2009 +0200
Fix calling methods returning structs and throwing errors
Argument order was incorrect, fixes bug 596228.
codegen/valaccodemethodcallmodule.vala | 2 +-
tests/Makefile.am | 1 +
tests/errors/bug596228.vala | 16 ++++++++++++++++
3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 5baa63a..5660bd6 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -567,7 +567,7 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
temp_vars.insert (0, temp_var);
- out_arg_map.set (get_param_pos (-3, true), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
+ out_arg_map.set (get_param_pos (-3), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
var ccomma = new CCodeCommaExpression ();
ccomma.append_expression ((CCodeExpression) ccall_expr);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cb29b92..f75f8ad 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,6 +44,7 @@ TESTS = \
objects/test-029.vala \
objects/test-034.vala \
errors/errors.vala \
+ errors/bug596228.vala \
dbus/basic-types.test \
dbus/arrays.test \
dbus/async.test \
diff --git a/tests/errors/bug596228.vala b/tests/errors/bug596228.vala
new file mode 100644
index 0000000..25456a3
--- /dev/null
+++ b/tests/errors/bug596228.vala
@@ -0,0 +1,16 @@
+struct Foo {
+ Foo (int foo) {
+ this.foo = foo;
+ }
+
+ int foo;
+}
+
+Foo get_foo () throws Error {
+ return Foo (42);
+}
+
+void main () {
+ var foo = get_foo ();
+ assert (foo.foo == 42);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]