diff src/json.c @ 7732:4a4f1dd1abe8 v7.4.1164

commit https://github.com/vim/vim/commit/6039c7f05376f0e470cf62bf2757e653aea357f3 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 24 15:05:32 2016 +0100 patch 7.4.1164 Problem: No tests for comparing special variables. Error in jsondecode() not reported. test_json does not work Japanse system. Solution: Set scriptencoding. (Ken Takata) Add a few more tests. Add error.
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jan 2016 15:15:04 +0100
parents 87f3f9536ecf
children f2ddad8cbce7
line wrap: on
line diff
--- a/src/json.c
+++ b/src/json.c
@@ -220,7 +220,7 @@ json_decode_array(js_read_T *reader, typ
     listitem_T	*li;
 
     if (rettv_list_alloc(res) == FAIL)
-	goto fail;
+	goto failsilent;
     ++reader->js_used; /* consume the '[' */
 
     while (TRUE)
@@ -253,6 +253,8 @@ json_decode_array(js_read_T *reader, typ
 	    goto fail;
     }
 fail:
+    EMSG(_(e_invarg));
+failsilent:
     res->v_type = VAR_SPECIAL;
     res->vval.v_number = VVAL_NONE;
 }
@@ -268,7 +270,7 @@ json_decode_object(js_read_T *reader, ty
     char_u	*key;
 
     if (rettv_dict_alloc(res) == FAIL)
-	goto fail;
+	goto failsilent;
     ++reader->js_used; /* consume the '{' */
 
     while (TRUE)
@@ -293,7 +295,7 @@ json_decode_object(js_read_T *reader, ty
 	    if (key != NULL)
 		EMSG(_(e_emptykey));
 	    clear_tv(&tvkey);
-	    goto fail;
+	    goto failsilent;
 	}
 
 	json_skip_white(reader);
@@ -329,6 +331,8 @@ json_decode_object(js_read_T *reader, ty
 	    goto fail;
     }
 fail:
+    EMSG(_(e_invarg));
+failsilent:
     res->v_type = VAR_SPECIAL;
     res->vval.v_number = VVAL_NONE;
 }