dictionary-delete raises an error when no binding with given name is registered

This commit is contained in:
Yuichi Nishiwaki 2014-06-15 01:46:31 +09:00
parent a8a56aa34e
commit 037967fd58
1 changed files with 4 additions and 0 deletions

View File

@ -67,6 +67,10 @@ pic_dict_dict_del(pic_state *pic)
pic_get_args(pic, "dm", &dict, &key);
if (xh_get_int(&dict->hash, key) == NULL) {
pic_errorf(pic, "no slot named ~s found in dictionary", pic_sym_value(key));
}
xh_del_int(&dict->hash, key);
return pic_none_value();