Commit 70bbd52f authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

disable null warnings with --disable-non-null

2008-04-19  Juerg Billeter  <j@bitron.ch>

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

svn path=/trunk/; revision=1264
parent e1de4502
2008-04-19 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: disable null warnings with
--disable-non-null
2008-04-19 Jürg Billeter <j@bitron.ch>
* vapi/packages/gio-2.0/: fix g_output_stream_write_all and
......
......@@ -547,13 +547,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
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 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
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 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment