diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-01 01:44:36 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-01 01:52:48 +0900 |
commit | 431a99b5569e90dd76677be273ad81640ce7e757 (patch) | |
tree | 2c56208cbf94671c2f5377c0121dd332eed863f0 /vm_args.c | |
parent | d4eef04883104c6b4618a843651584cb65c9428d (diff) |
Split warning messages for tag-jump
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -585,13 +585,16 @@ static inline void rb_warn_keyword_to_last_hash(struct rb_calling_info *calling, const struct rb_call_info *ci, const rb_iseq_t * const iseq) { if (calling->recv == Qundef) return; + VALUE name = rb_id2str(ci->mid); VALUE loc = rb_iseq_location(iseq); if (NIL_P(loc)) { - rb_warn("The keyword argument for `%s' is passed as the last hash parameter", rb_id2name(ci->mid)); + rb_warn("The keyword argument for `%"PRIsVALUE"' is passed as the last hash parameter", + name); } else { - rb_warn("The keyword argument for `%s' (defined at %s:%d) is passed as the last hash parameter", - rb_id2name(ci->mid), RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1))); + rb_warn("The keyword argument is passed as the last hash parameter"); + rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), + "for `%"PRIsVALUE"' defined here", name); } } @@ -599,13 +602,16 @@ static inline void rb_warn_split_last_hash_to_keyword(struct rb_calling_info *calling, const struct rb_call_info *ci, const rb_iseq_t * const iseq) { if (calling->recv == Qundef) return; + VALUE name = rb_id2str(ci->mid); VALUE loc = rb_iseq_location(iseq); if (NIL_P(loc)) { - rb_warn("The last argument for `%s' is split into positional and keyword parameters", rb_id2name(ci->mid)); + rb_warn("The last argument for `%"PRIsVALUE"' is split into positional and keyword parameters", + name); } else { - rb_warn("The last argument for `%s' (defined at %s:%d) is split into positional and keyword parameters", - rb_id2name(ci->mid), RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1))); + rb_warn("The last argument is split into positional and keyword parameters"); + rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), + "for `%"PRIsVALUE"' defined here", name); } } @@ -613,13 +619,16 @@ static inline void rb_warn_last_hash_to_keyword(struct rb_calling_info *calling, const struct rb_call_info *ci, const rb_iseq_t * const iseq) { if (calling->recv == Qundef) return; + VALUE name = rb_id2str(ci->mid); VALUE loc = rb_iseq_location(iseq); if (NIL_P(loc)) { - rb_warn("The last argument for `%s' is used as the keyword parameter", rb_id2name(ci->mid)); + rb_warn("The last argument for `%"PRIsVALUE"' is used as the keyword parameter", + name); } else { - rb_warn("The last argument for `%s' (defined at %s:%d) is used as the keyword parameter", - rb_id2name(ci->mid), RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1))); + rb_warn("The last argument is used as the keyword parameter"); + rb_compile_warn(RSTRING_PTR(RARRAY_AREF(loc, 0)), FIX2INT(RARRAY_AREF(loc, 1)), + "for `%"PRIsVALUE"' defined here", name); } } |