[vala] Report error on unsupported constructor chain up



commit 85d4d9b16cb1f00d935cf34a280767200e8cc4b7
Author: Jürg Billeter <j bitron ch>
Date:   Sun Aug 16 21:57:38 2009 +0200

    Report error on unsupported constructor chain up
    
    Fixes bug 581362.

 vala/valamethodcall.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index a4763b8..5f9f909 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -147,6 +147,15 @@ public class Vala.MethodCall : Expression {
 				return false;
 			}
 			cm.chain_up = true;
+
+			var otype = (ObjectType) mtype;
+			var cl = (Class) otype.type_symbol;
+			var base_cm = cl.default_construction_method;
+			if (!base_cm.has_construct_function) {
+				error = true;
+				Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ()));
+				return false;
+			}
 		}
 
 		// check for struct construction
@@ -178,6 +187,13 @@ public class Vala.MethodCall : Expression {
 				return false;
 			}
 			cm.chain_up = true;
+
+			var base_cm = (CreationMethod) call.symbol_reference;
+			if (!base_cm.has_construct_function) {
+				error = true;
+				Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ()));
+				return false;
+			}
 		}
 
 		Gee.List<FormalParameter> params;



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