diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-09-24 21:43:46 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-09-24 21:43:46 +0900 |
| commit | 07856a7e8fce933309ba1ce118beddeeddbbb2b1 (patch) | |
| tree | 3be41aa2304340c76da6057f57766d22d379167e /src | |
| parent | 4f0f712b510ae85301fc9280d2fbef6b3511b9de (diff) | |
| download | mruby-07856a7e8fce933309ba1ce118beddeeddbbb2b1.tar.gz mruby-07856a7e8fce933309ba1ce118beddeeddbbb2b1.zip | |
`Exception#initialize` should not allow two or more arguments
Diffstat (limited to 'src')
| -rw-r--r-- | src/error.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/error.c b/src/error.c index ad0be209d..babd13b14 100644 --- a/src/error.c +++ b/src/error.c @@ -44,10 +44,8 @@ static mrb_value exc_initialize(mrb_state *mrb, mrb_value exc) { mrb_value mesg; - mrb_int argc; - mrb_value *argv; - if (mrb_get_args(mrb, "|o*!", &mesg, &argv, &argc) >= 1) { + if (mrb_get_args(mrb, "|o", &mesg) == 1) { mrb_iv_set(mrb, exc, mrb_intern_lit(mrb, "mesg"), mesg); } return exc; @@ -590,9 +588,9 @@ mrb_init_exception(mrb_state *mrb) mrb->eException_class = exception = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */ MRB_SET_INSTANCE_TT(exception, MRB_TT_EXCEPTION); - mrb_define_class_method(mrb, exception, "exception", mrb_instance_new, MRB_ARGS_ANY()); + mrb_define_class_method(mrb, exception, "exception", mrb_instance_new, MRB_ARGS_OPT(1)); mrb_define_method(mrb, exception, "exception", exc_exception, MRB_ARGS_ANY()); - mrb_define_method(mrb, exception, "initialize", exc_initialize, MRB_ARGS_ANY()); + mrb_define_method(mrb, exception, "initialize", exc_initialize, MRB_ARGS_OPT(1)); mrb_define_method(mrb, exception, "to_s", exc_to_s, MRB_ARGS_NONE()); mrb_define_method(mrb, exception, "message", exc_message, MRB_ARGS_NONE()); mrb_define_method(mrb, exception, "inspect", exc_inspect, MRB_ARGS_NONE()); |
