diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-04 08:13:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-04 08:13:37 +0000 |
commit | df2b8c05bac6414d5dae001310a09a2842910dcf (patch) | |
tree | 5470ee4c746ee0beebb4fce33e086f50f70bd0ba | |
parent | 9acd2b20c8fa85fe2ca827dbba195f5f12a16df0 (diff) |
Show proper location for warning [Feature #15575]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | compile.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -5922,14 +5922,17 @@ qcall_branch_end(rb_iseq_t *iseq, LINK_ANCHOR *const ret, LABEL *else_label, VAL } static int -check_yield_place(const rb_iseq_t *iseq) +check_yield_place(const rb_iseq_t *iseq, int line) { + VALUE file; switch (iseq->body->local_iseq->body->type) { case ISEQ_TYPE_TOP: case ISEQ_TYPE_MAIN: return FALSE; case ISEQ_TYPE_CLASS: - rb_warn("`yield' in class syntax will not be supported from Ruby 3.0. [Feature #15575]"); + file = rb_iseq_path(iseq); + rb_compile_warn(RSTRING_PTR(file), line, + "`yield' in class syntax will not be supported from Ruby 3.0. [Feature #15575]"); return TRUE; default: return TRUE; @@ -6843,7 +6846,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in INIT_ANCHOR(args); - if (check_yield_place(iseq) == FALSE) { + if (check_yield_place(iseq, line) == FALSE) { COMPILE_ERROR(ERROR_ARGS "Invalid yield"); goto ng; } |