vala r1264 - in trunk: . vala



Author: juergbi
Date: Sat Apr 19 07:30:12 2008
New Revision: 1264
URL: http://svn.gnome.org/viewvc/vala?rev=1264&view=rev

Log:
2008-04-19  Juerg Billeter  <j bitron ch>

	* vala/valasemanticanalyzer.vala: disable null warnings with
	 --disable-non-null


Modified:
   trunk/ChangeLog
   trunk/vala/valasemanticanalyzer.vala

Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala	(original)
+++ trunk/vala/valasemanticanalyzer.vala	Sat Apr 19 07:30:12 2008
@@ -547,13 +547,11 @@
 	public override void visit_formal_parameter (FormalParameter p) {
 		p.accept_children (this);
 
-		if (p.default_expression != null) {
+		if (context.non_null && p.default_expression != null) {
 			if (p.default_expression is NullLiteral
 			    && !p.type_reference.nullable
 			    && p.direction != ParameterDirection.OUT) {
-				p.error = true;
-				Report.error (p.source_reference, "`null' incompatible with parameter type `%s`".printf (p.type_reference.to_string ()));
-				return;
+				Report.warning (p.source_reference, "`null' incompatible with parameter type `%s`".printf (p.type_reference.to_string ()));
 			}
 		}
 
@@ -1172,7 +1170,7 @@
 			Report.warning (stmt.source_reference, "Local variable with strong reference used as return value and method return type hasn't been declared to transfer ownership");
 		}
 
-		if (stmt.return_expression is NullLiteral
+		if (context.non_null && stmt.return_expression is NullLiteral
 		    && !current_return_type.nullable) {
 			Report.warning (stmt.source_reference, "`null' incompatible with return type `%s`".printf (current_return_type.to_string ()));
 		}
@@ -1868,7 +1866,7 @@
 							expr.error = true;
 							Report.error (arg.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
 							return false;
-						} else if (param.direction != ParameterDirection.OUT && !param.type_reference.nullable) {
+						} else if (context.non_null && param.direction != ParameterDirection.OUT && !param.type_reference.nullable) {
 							Report.warning (arg.source_reference, "Argument %d: Cannot pass null to non-null parameter type".printf (i + 1));
 						}
 					} else if (arg_type == 1) {



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