vala r2365 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2365 - in trunk: . vala
- Date: Fri, 16 Jan 2009 20:50:07 +0000 (UTC)
Author: juergbi
Date: Fri Jan 16 20:50:07 2009
New Revision: 2365
URL: http://svn.gnome.org/viewvc/vala?rev=2365&view=rev
Log:
2009-01-16 JÃrg Billeter <j bitron ch>
* vala/valaexpression.vala:
* vala/valareturnstatement.vala:
Report error when returning owned variable in method or property
with unowned return value, fixes bug 547102
Modified:
trunk/ChangeLog
trunk/vala/valaexpression.vala
trunk/vala/valareturnstatement.vala
Modified: trunk/vala/valaexpression.vala
==============================================================================
--- trunk/vala/valaexpression.vala (original)
+++ trunk/vala/valaexpression.vala Fri Jan 16 20:50:07 2009
@@ -1,6 +1,6 @@
/* valaexpression.vala
*
- * Copyright (C) 2006-2008 JÃrg Billeter
+ * Copyright (C) 2006-2009 JÃrg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -91,7 +91,7 @@
var stmt = parent_node as Statement;
var local = parent_node as LocalVariable;
if (stmt != null) {
- return stmt;
+ return (Statement) parent_node;
} else if (expr != null) {
return expr.parent_statement;
} else if (local != null) {
Modified: trunk/vala/valareturnstatement.vala
==============================================================================
--- trunk/vala/valareturnstatement.vala (original)
+++ trunk/vala/valareturnstatement.vala Fri Jan 16 20:50:07 2009
@@ -126,10 +126,12 @@
return false;
}
- if (return_expression.symbol_reference is LocalVariable &&
- return_expression.value_type.is_disposable () &&
+ var local = return_expression.symbol_reference as LocalVariable;
+ if (local != null && local.variable_type.is_disposable () &&
!analyzer.current_return_type.value_owned) {
- Report.warning (source_reference, "Local variable with strong reference used as return value and method return type hasn't been declared to transfer ownership");
+ error = true;
+ Report.error (source_reference, "Local variable with strong reference used as return value and method return type has not been declared to transfer ownership");
+ return false;
}
if (return_expression is NullLiteral
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]