[vala] codegen: Forbid creating closures for delegates without target



commit 807ce91bd9a453b0688dfc499862f14c3933199c
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed May 25 12:48:32 2011 +0200

    codegen: Forbid creating closures for delegates without target
    
    Fixes bug 645841.

 codegen/valaccodedelegatemodule.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index 4d2e1bb..bb38b85 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -292,7 +292,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
 				arg = new CCodeIdentifier ("self");
 			} else {
 				// use first delegate parameter as instance
-				if (d_params.size == 0) {
+				if (d_params.size == 0 || m.closure) {
 					Report.error (node != null ? node.source_reference : null, "Cannot create delegate without target for instance method or closure");
 					arg = new CCodeConstant ("NULL");
 				} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]