зеркало из https://github.com/github/ruby.git
hash.c: refine error messages
* hash.c (rb_hash_s_create): refine error messages. * error.c (rb_builtin_class_name): share for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
10ba3bdd53
Коммит
5a5a86cc52
|
@ -1,3 +1,9 @@
|
|||
Sun Nov 11 15:38:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* hash.c (rb_hash_s_create): refine error messages.
|
||||
|
||||
* error.c (rb_builtin_class_name): share for above.
|
||||
|
||||
Sun Nov 11 15:12:18 2012 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* eval.c (top_using): remove Kernel#using, and add main.using instead.
|
||||
|
|
|
@ -662,7 +662,7 @@ gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
|
|||
{$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
|
||||
{$(VPATH)}thread.h
|
||||
hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
|
||||
$(ENCODING_H_INCLUDES)
|
||||
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
|
||||
inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) \
|
||||
{$(VPATH)}internal.h
|
||||
io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
|
||||
|
|
5
error.c
5
error.c
|
@ -432,8 +432,9 @@ rb_builtin_type_name(int t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
builtin_class_name(VALUE x)
|
||||
#define builtin_class_name rb_builtin_class_name
|
||||
const char *
|
||||
rb_builtin_class_name(VALUE x)
|
||||
{
|
||||
const char *etype;
|
||||
|
||||
|
|
8
hash.c
8
hash.c
|
@ -15,6 +15,7 @@
|
|||
#include "ruby/st.h"
|
||||
#include "ruby/util.h"
|
||||
#include "ruby/encoding.h"
|
||||
#include "internal.h"
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -392,11 +393,14 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
|
|||
|
||||
hash = hash_alloc(klass);
|
||||
for (i = 0; i < RARRAY_LEN(tmp); ++i) {
|
||||
VALUE v = rb_check_array_type(RARRAY_PTR(tmp)[i]);
|
||||
VALUE e = RARRAY_PTR(tmp)[i];
|
||||
VALUE v = rb_check_array_type(e);
|
||||
VALUE key, val = Qnil;
|
||||
|
||||
if (NIL_P(v)) {
|
||||
rb_raise(rb_eArgError, "wrong element type (expected array)");
|
||||
rb_raise(rb_eArgError, "wrong element type %s at %ld (expected array)",
|
||||
rb_builtin_class_name(e), i);
|
||||
|
||||
}
|
||||
switch (RARRAY_LEN(v)) {
|
||||
default:
|
||||
|
|
|
@ -95,6 +95,7 @@ NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3,
|
|||
VALUE rb_check_backtrace(VALUE);
|
||||
NORETURN(void rb_async_bug_errno(const char *,int));
|
||||
const char *rb_builtin_type_name(int t);
|
||||
const char *rb_builtin_class_name(VALUE x);
|
||||
|
||||
/* eval_error.c */
|
||||
void ruby_error_print(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче