diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -2745,9 +2745,14 @@ rb_eval(self, n) TMP_PROTECT; if (ruby_frame->last_class == 0) { - rb_name_error(ruby_frame->last_func, - "superclass method `%s' disabled", - rb_id2name(ruby_frame->last_func)); + if (ruby_frame->last_func) { + rb_name_error(ruby_frame->last_func, + "superclass method `%s' disabled", + rb_id2name(ruby_frame->last_func)); + } + else { + rb_raise(rb_eNoMethodError, "super called outside of method"); + } } if (nd_type(node) == NODE_ZSUPER) { argc = ruby_frame->argc; |