diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-07-26 15:14:49 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-07-29 09:01:23 -0700 |
commit | aa97410b0a85cb4ceb956ab943b5eee92a128411 (patch) | |
tree | c3463f6004d4fe33887e34e9362cc067529700cb /compile.c | |
parent | c2428b8bf6f3646f575c21d0c89192d79130f7cc (diff) |
Warn if using return at top-level with an argument
Fixes [Bug #14062]
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -6372,6 +6372,9 @@ compile_return(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, switch (t) { case ISEQ_TYPE_TOP: case ISEQ_TYPE_MAIN: + if (retval) { + rb_warn("argument of top-level return is ignored"); + } if (is == iseq) { /* plain top-level, leave directly */ type = ISEQ_TYPE_METHOD; |