]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Warn if a parameter without default follows a parameter with default value b22255aa25e0296211ea7ca404970d1677747180
authorSimon Werbeck <simon.werbeck@gmail.com>
Sat, 6 Apr 2013 06:51:19 +0000 (08:51 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 24 Aug 2013 11:00:14 +0000 (13:00 +0200)
Fixes bug 644241.

vala/valamethod.vala
vapi/glib-2.0.vapi

index 5e5f82649ab2b276db263184e67407720cf5ad8f..f1b757777cb3154bffa656a07e8e8107a9db1695 100644 (file)
@@ -654,12 +654,18 @@ public class Vala.Method : Subroutine {
                        Report.error (parameters[0].source_reference, "Named parameter required before `...'");
                }
 
+               var optional_param = false;
                foreach (Parameter param in parameters) {
                        param.check (context);
                        if (coroutine && param.direction == ParameterDirection.REF) {
                                error = true;
                                Report.error (param.source_reference, "Reference parameters are not supported for async methods");
                        }
+                       if (optional_param && param.initializer == null) {
+                               Report.warning (param.source_reference, "parameter without default follows parameter with default");
+                       } else if (param.initializer != null) {
+                               optional_param = true;
+                       }
                }
 
                foreach (DataType error_type in get_error_types ()) {
index 9f6d77c1af2588c0611661ee90f5b2e94f194f94..934d026eb14b202a0bb2d62bd168ecc396d9018c 100644 (file)
@@ -3449,7 +3449,7 @@ namespace GLib {
                public string[] split_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError;
                public string replace (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
                public string replace_literal (string str, ssize_t string_len, int start_position, string replacement, RegexMatchFlags match_options = 0) throws RegexError;
-               public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options = 0, RegexEvalCallback eval) throws RegexError;
+               public string replace_eval (string str, ssize_t string_len, int start_position, RegexMatchFlags match_options, RegexEvalCallback eval) throws RegexError;
                public static bool check_replacement (out bool has_references = null) throws RegexError;
        }