From 7082c10201cd471e85f80a07ab161ea20442f33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Sun, 21 Mar 2010 16:14:58 +0100 Subject: Fix closures in property accessors Fixes bug 613483. --- codegen/valaccodememberaccessmodule.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'codegen/valaccodememberaccessmodule.vala') diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala index 3ebb4bf5d..edfa1333b 100644 --- a/codegen/valaccodememberaccessmodule.vala +++ b/codegen/valaccodememberaccessmodule.vala @@ -380,7 +380,10 @@ internal class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { } else { if (p.captured) { // captured variables are stored on the heap - var block = ((Method) p.parent_symbol).body; + var block = p.parent_symbol as Block; + if (block == null) { + block = ((Method) p.parent_symbol).body; + } expr.ccodenode = new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id (block))), get_variable_cname (p.name)); } else if (current_method != null && current_method.coroutine) { // use closure -- cgit v1.2.1