mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Dump FrozenCore specially
This commit is contained in:
parent
d915e7ee00
commit
081cc4eb28
3 changed files with 23 additions and 2 deletions
3
iseq.c
3
iseq.c
|
@ -1861,6 +1861,7 @@ local_var_name(const rb_iseq_t *diseq, VALUE level, VALUE op)
|
|||
}
|
||||
|
||||
int rb_insn_unified_local_var_level(VALUE);
|
||||
VALUE rb_dump_literal(VALUE lit);
|
||||
|
||||
VALUE
|
||||
rb_insn_operand_intern(const rb_iseq_t *iseq,
|
||||
|
@ -1936,7 +1937,7 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
|
|||
break;
|
||||
}
|
||||
}
|
||||
ret = rb_inspect(op);
|
||||
ret = rb_dump_literal(op);
|
||||
if (CLASS_OF(op) == rb_cISeq) {
|
||||
if (child) {
|
||||
rb_ary_push(child, op);
|
||||
|
|
21
node.c
21
node.c
|
@ -26,7 +26,7 @@
|
|||
#define A_ID(id) add_id(buf, (id))
|
||||
#define A_INT(val) rb_str_catf(buf, "%d", (val))
|
||||
#define A_LONG(val) rb_str_catf(buf, "%ld", (val))
|
||||
#define A_LIT(lit) AR(rb_inspect(lit))
|
||||
#define A_LIT(lit) AR(rb_dump_literal(lit))
|
||||
#define A_NODE_HEADER(node, term) \
|
||||
rb_str_catf(buf, "@ %s (line: %d, location: (%d,%d)-(%d,%d))%s"term, \
|
||||
ruby_node_name(nd_type(node)), nd_line(node), \
|
||||
|
@ -79,6 +79,25 @@
|
|||
|
||||
#define LAST_NODE (next_indent = " ")
|
||||
|
||||
VALUE
|
||||
rb_dump_literal(VALUE lit)
|
||||
{
|
||||
if (!RB_SPECIAL_CONST_P(lit)) {
|
||||
VALUE str;
|
||||
switch (RB_BUILTIN_TYPE(lit)) {
|
||||
case T_CLASS: case T_MODULE: case T_ICLASS:
|
||||
str = rb_class_path(lit);
|
||||
if (FL_TEST(lit, FL_SINGLETON)) {
|
||||
str = rb_sprintf("<%"PRIsVALUE">", str);
|
||||
}
|
||||
return str;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rb_inspect(lit);
|
||||
}
|
||||
|
||||
static void
|
||||
add_indent(VALUE buf, VALUE indent)
|
||||
{
|
||||
|
|
1
vm.c
1
vm.c
|
@ -3123,6 +3123,7 @@ Init_VM(void)
|
|||
|
||||
/* FrozenCore (hidden) */
|
||||
fcore = rb_class_new(rb_cBasicObject);
|
||||
rb_set_class_path(fcore, rb_cRubyVM, "FrozenCore");
|
||||
RBASIC(fcore)->flags = T_ICLASS;
|
||||
klass = rb_singleton_class(fcore);
|
||||
rb_define_method_id(klass, id_core_set_method_alias, m_core_set_method_alias, 3);
|
||||
|
|
Loading…
Add table
Reference in a new issue