From ba772af0a6b36713077799e5c5cbcb375d4ee1c8 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 20 Nov 2015 23:49:31 +0000 Subject: * compile.c (iseq_compile_each): add debug information to NODE_STR strings as default. [Feature #11725] * insns.def (freezestring): add new instruction to support adding debug information for dynamically constracted strings. * compile.c (iseq_compile_each): support adding debug information for NODE_DSTR with freezestring instruction. * error.c (rb_error_frozen): change the debug information ID name id_debug_created_info and this field should have a 2 element array containing path and line information. * defs/id.def: ditto. * test/ruby/test_rubyoptions.rb: catch up this fix. * test/ruby/test_iseq.rb: now frozen strings are not same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 3dbdb5240f..816d704a1e 100644 --- a/error.c +++ b/error.c @@ -2241,12 +2241,13 @@ rb_error_frozen(const char *what) void rb_error_frozen_object(VALUE frozen_obj) { - VALUE path, line; - const ID created_path = id_debug_created_path; - const ID created_line = id_debug_created_line; + VALUE debug_info; + const ID created_info = id_debug_created_info; + + if (!NIL_P(debug_info = rb_attr_get(frozen_obj, created_info))) { + VALUE path = rb_ary_entry(debug_info, 0); + VALUE line = rb_ary_entry(debug_info, 1); - if (!NIL_P(path = rb_attr_get(frozen_obj, created_path)) && - !NIL_P(line = rb_attr_get(frozen_obj, created_line))) { rb_raise(rb_eRuntimeError, "can't modify frozen %"PRIsVALUE", created at %"PRIsVALUE":%"PRIsVALUE, CLASS_OF(frozen_obj), path, line); } -- cgit v1.2.3