vala r2121 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2121 - in trunk: . vala
- Date: Sat, 6 Dec 2008 11:18:37 +0000 (UTC)
Author: juergbi
Date: Sat Dec 6 11:18:37 2008
New Revision: 2121
URL: http://svn.gnome.org/viewvc/vala?rev=2121&view=rev
Log:
2008-12-06 JÃrg Billeter <j bitron ch>
* vala/valamethodcall.vala:
Report error when trying to call constructor without `new' operator
Modified:
trunk/ChangeLog
trunk/vala/valamethodcall.vala
Modified: trunk/vala/valamethodcall.vala
==============================================================================
--- trunk/vala/valamethodcall.vala (original)
+++ trunk/vala/valamethodcall.vala Sat Dec 6 11:18:37 2008
@@ -155,8 +155,11 @@
if (mtype is ObjectType) {
// constructor chain-up
var cm = analyzer.find_current_method () as CreationMethod;
- assert (cm != null);
- if (cm.chain_up) {
+ if (cm == null) {
+ error = true;
+ Report.error (source_reference, "use `new' operator to create new objects");
+ return false;
+ } else if (cm.chain_up) {
error = true;
Report.error (source_reference, "Multiple constructor calls in the same constructor are not permitted");
return false;
@@ -183,8 +186,11 @@
&& call.symbol_reference is CreationMethod) {
// constructor chain-up
var cm = analyzer.find_current_method () as CreationMethod;
- assert (cm != null);
- if (cm.chain_up) {
+ if (cm == null) {
+ error = true;
+ Report.error (source_reference, "use `new' operator to create new objects");
+ return false;
+ } else if (cm.chain_up) {
error = true;
Report.error (source_reference, "Multiple constructor calls in the same constructor are not permitted");
return false;
@@ -196,6 +202,10 @@
if (mtype != null && mtype.is_invokable ()) {
params = mtype.get_parameters ();
+ } else if (call.symbol_reference is Class) {
+ error = true;
+ Report.error (source_reference, "use `new' operator to create new objects");
+ return false;
} else {
error = true;
Report.error (source_reference, "invocation not supported in this context");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]