+2008-01-10 Jürg Billeter <j@bitron.ch>
+
+ * vala/valasemanticanalyzer.vala: check in/ref/out arguments
+
+ * vapi/packages/gtk+-2.0/gtk+-2.0-custom.vala: fix gtk_init
+
+ * vapi/gtk+-2.0.vapi: regenerated
+
2008-01-09 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vapi: add bindings for uri functions
expr.error = true;
Report.error (expr.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.static_type.to_string (), param.type_reference.to_string ()));
return false;
+ } else {
+ // 0 => null, 1 => in, 2 => ref, 3 => out
+ int arg_type = 1;
+ if (arg.static_type is NullType) {
+ arg_type = 0;
+ } else if (arg is UnaryExpression) {
+ var unary = (UnaryExpression) arg;
+ if (unary.operator == UnaryOperator.REF) {
+ arg_type = 2;
+ } else if (unary.operator == UnaryOperator.OUT) {
+ arg_type = 3;
+ }
+ }
+
+ if (arg_type == 0) {
+ if (param.type_reference.is_ref) {
+ expr.error = true;
+ Report.error (expr.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
+ return false;
+ }
+ } else if (arg_type == 1) {
+ if (param.type_reference.is_ref || param.type_reference.is_out) {
+ expr.error = true;
+ Report.error (expr.source_reference, "Argument %d: Cannot pass value to reference or output parameter".printf (i + 1));
+ return false;
+ }
+ } else if (arg_type == 2) {
+ if (!param.type_reference.is_ref) {
+ expr.error = true;
+ Report.error (expr.source_reference, "Argument %d: Cannot pass ref argument to non-reference parameter".printf (i + 1));
+ return false;
+ }
+ } else if (arg_type == 3) {
+ if (!param.type_reference.is_out) {
+ expr.error = true;
+ Report.error (expr.source_reference, "Argument %d: Cannot pass out argument to non-output parameter".printf (i + 1));
+ return false;
+ }
+ }
}
prev_arg = arg;
public const string STOCK_ZOOM_OUT;
public const int TEXT_VIEW_PRIORITY_VALIDATE;
public const int TYPE_FUNDAMENTAL_LAST;
- public static void init (out string[] args);
+ public static void init (ref string[] args);
public static bool accel_groups_activate (GLib.Object object, uint accel_key, Gdk.ModifierType accel_mods);
public static weak GLib.SList accel_groups_from_object (GLib.Object object);
public static uint accelerator_get_default_mod_mask ();
/* gtk+-2.0.vala
*
- * Copyright (C) 2006-2007 Jürg Billeter
+ * Copyright (C) 2006-2008 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
namespace Gtk {
[Import]
- public void init (out string[] args);
+ public void init (ref string[] args);
public struct Allocation {
public int x;