Ruby 4.0.6p0 (2026-07-14 revision 03b6d3f8898a28604fe6cb00eae3226b821168f4)
eval_error.c
1/* -*-c-*- */
2/*
3 * included by eval.c
4 */
5
6#define write_warn(str, x) \
7 (NIL_P(str) ? warn_print(x) : (void)rb_str_cat_cstr(str, x))
8#define write_warn2(str, x, l) \
9 (NIL_P(str) ? warn_print2(x, l) : (void)rb_str_cat(str, x, l))
10#define write_warn_enc(str, x, l, enc) \
11 (NIL_P(str) ? warn_print2(x, l) : (void)rb_enc_str_buf_cat(str, x, l, enc))
12#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
13#define warn_print(x) RB_GNUC_EXTENSION_BLOCK( \
14 (__builtin_constant_p(x)) ? \
15 rb_write_error2((x), (long)strlen(x)) : \
16 rb_write_error(x) \
17)
18#else
19#define warn_print(x) rb_write_error(x)
20#endif
21
22#define warn_print2(x,l) rb_write_error2((x),(l))
23
24#define write_warn_str(str,x) NIL_P(str) ? rb_write_error_str(x) : (void)rb_str_concat((str), (x))
25#define warn_print_str(x) rb_write_error_str(x)
26
27static VALUE error_pos_str(void);
28
29static void
30error_pos(const VALUE str)
31{
32 VALUE pos = error_pos_str();
33 if (!NIL_P(pos)) {
34 write_warn_str(str, pos);
35 }
36}
37
38static VALUE
39error_pos_str(void)
40{
41 int sourceline;
42 VALUE sourcefile = rb_source_location(&sourceline);
43
44 if (!NIL_P(sourcefile)) {
45 ID caller_name;
46 if (sourceline == 0) {
47 return rb_sprintf("%"PRIsVALUE": ", sourcefile);
48 }
49 else if ((caller_name = rb_frame_callee()) != 0) {
50 return rb_sprintf("%"PRIsVALUE":%d:in '%"PRIsVALUE"': ",
51 sourcefile, sourceline,
52 rb_id2str(caller_name));
53 }
54 else {
55 return rb_sprintf("%"PRIsVALUE":%d: ", sourcefile, sourceline);
56 }
57 }
58 return Qnil;
59}
60
61static void
62set_backtrace(VALUE info, VALUE bt)
63{
64 ID set_backtrace = rb_intern("set_backtrace");
65
66 if (rb_backtrace_p(bt)) {
67 if (rb_method_basic_definition_p(CLASS_OF(info), set_backtrace)) {
68 rb_exc_set_backtrace(info, bt);
69 return;
70 }
71 else {
72 bt = rb_backtrace_to_str_ary(bt);
73 }
74 }
75 rb_check_funcall(info, set_backtrace, 1, &bt);
76}
77
78#define CSI_BEGIN "\033["
79#define CSI_SGR "m"
80
81static const char underline[] = CSI_BEGIN"1;4"CSI_SGR;
82static const char bold[] = CSI_BEGIN"1"CSI_SGR;
83static const char reset[] = CSI_BEGIN""CSI_SGR;
84
85static void
86print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg, const VALUE str, int highlight)
87{
88 long elen = 0;
89 VALUE mesg;
90
91 if (NIL_P(errat) || RARRAY_LEN(errat) == 0 ||
92 NIL_P(mesg = RARRAY_AREF(errat, 0))) {
93 error_pos(str);
94 }
95 else {
96 write_warn_str(str, mesg);
97 write_warn(str, ": ");
98 }
99
100 if (!NIL_P(emesg)) {
101 elen = RSTRING_LEN(emesg);
102 }
103
104 if (eclass == rb_eRuntimeError && elen == 0) {
105 if (highlight) write_warn(str, underline);
106 write_warn(str, "unhandled exception");
107 if (highlight) write_warn(str, reset);
108 write_warn(str, "\n");
109 }
110 else {
111 VALUE epath;
112
113 epath = rb_class_name(eclass);
114 if (elen == 0) {
115 if (highlight) write_warn(str, underline);
116 write_warn_str(str, epath);
117 if (highlight) write_warn(str, reset);
118 write_warn(str, "\n");
119 }
120 else {
121 write_warn_str(str, emesg);
122 write_warn(str, "\n");
123 }
124 }
125}
126
127VALUE
128rb_decorate_message(const VALUE eclass, VALUE emesg, int highlight)
129{
130 const char *einfo = "";
131 long elen = 0;
132 rb_encoding *eenc;
133
135
136 if (!NIL_P(emesg) && rb_enc_asciicompat(eenc = rb_enc_get(emesg))) {
137 einfo = RSTRING_PTR(emesg);
138 elen = RSTRING_LEN(emesg);
139 }
140 else {
141 eenc = NULL;
142 }
143 if (eclass == rb_eRuntimeError && elen == 0) {
144 if (highlight) write_warn(str, underline);
145 write_warn(str, "unhandled exception");
146 if (highlight) write_warn(str, reset);
147 }
148 else {
149 VALUE epath;
150
151 epath = rb_class_name(eclass);
152 if (elen == 0) {
153 if (highlight) write_warn(str, underline);
154 write_warn_str(str, epath);
155 if (highlight) write_warn(str, reset);
156 }
157 else {
158 /* emesg is a String instance */
159 const char *tail = 0;
160
161 if (highlight) write_warn(str, bold);
162 if (RSTRING_PTR(epath)[0] == '#')
163 epath = 0;
164 if ((tail = memchr(einfo, '\n', elen)) != 0) {
165 write_warn_enc(str, einfo, tail - einfo, eenc);
166 tail++; /* skip newline */
167 }
168 else {
169 write_warn_str(str, emesg);
170 }
171 if (epath) {
172 write_warn(str, " (");
173 if (highlight) write_warn(str, underline);
174 write_warn_str(str, epath);
175 if (highlight) {
176 write_warn(str, reset);
177 write_warn(str, bold);
178 }
179 write_warn(str, ")");
180 if (highlight) write_warn(str, reset);
181 }
182 if (tail && einfo+elen > tail) {
183 if (!highlight) {
184 write_warn(str, "\n");
185 write_warn_enc(str, tail, einfo+elen-tail, eenc);
186 }
187 else {
188 elen -= tail - einfo;
189 einfo = tail;
190 write_warn(str, "\n");
191 while (elen > 0) {
192 tail = memchr(einfo, '\n', elen);
193 if (!tail || tail > einfo) {
194 write_warn(str, bold);
195 write_warn_enc(str, einfo, tail ? tail-einfo : elen, eenc);
196 write_warn(str, reset);
197 if (!tail) {
198 break;
199 }
200 }
201 elen -= tail - einfo;
202 einfo = tail;
203 do ++tail; while (tail < einfo+elen && *tail == '\n');
204 write_warn_enc(str, einfo, tail-einfo, eenc);
205 elen -= tail - einfo;
206 einfo = tail;
207 }
208 }
209 }
210 }
211 }
212
213 RB_GC_GUARD(emesg);
214
215 return str;
216}
217
218static void
219print_backtrace(const VALUE eclass, const VALUE errat, const VALUE str, int reverse, long backtrace_limit)
220{
221 if (!NIL_P(errat)) {
222 long i;
223 long len = RARRAY_LEN(errat);
224 const int threshold = 1000000000;
225 int width = (len <= 1) ? INT_MIN : ((int)log10((double)(len > threshold ?
226 ((len - 1) / threshold) :
227 len - 1)) +
228 (len < threshold ? 0 : 9) + 1);
229
230 long skip_start = -1, skip_len = 0;
231
232 // skip for stackoverflow
233 if (eclass == rb_eSysStackError) {
234 long trace_head = 9;
235 long trace_tail = 4;
236 long trace_max = trace_head + trace_tail + 5;
237 if (len > trace_max) {
238 skip_start = trace_head;
239 skip_len = len - trace_max + 5;
240 }
241 }
242
243 // skip for explicit limit
244 if (backtrace_limit >= 0 && len > backtrace_limit + 2) {
245 skip_start = backtrace_limit + 1;
246 skip_len = len - skip_start;
247 }
248
249 for (i = 1; i < len; i++) {
250 if (i == skip_start) {
251 write_warn_str(str, rb_sprintf("\t ... %ld levels...\n", skip_len));
252 i += skip_len;
253 if (i >= len) break;
254 }
255 VALUE line = RARRAY_AREF(errat, reverse ? len - i : i);
256 if (RB_TYPE_P(line, T_STRING)) {
257 VALUE bt = rb_str_new_cstr("\t");
258 if (reverse) rb_str_catf(bt, "%*ld: ", width, len - i);
259 write_warn_str(str, rb_str_catf(bt, "from %"PRIsVALUE"\n", line));
260 }
261 }
262 }
263}
264
265VALUE rb_get_detailed_message(VALUE exc, VALUE opt);
266
267static int
268shown_cause_p(VALUE cause, VALUE *shown_causes)
269{
270 VALUE shown = *shown_causes;
271 if (!shown) {
272 *shown_causes = shown = rb_obj_hide(rb_ident_hash_new());
273 }
274 if (rb_hash_has_key(shown, cause)) return TRUE;
275 rb_hash_aset(shown, cause, Qtrue);
276 return FALSE;
277}
278
279static void
280add_shown_cause(VALUE cause, VALUE *shown_causes)
281{
282 if (!NIL_OR_UNDEF_P(cause) &&
283 !THROW_DATA_P(cause) &&
285 shown_cause_p(cause, shown_causes);
286 }
287}
288
289static void
290show_cause(VALUE errinfo, VALUE str, VALUE opt, VALUE highlight, VALUE reverse, long backtrace_limit, VALUE *shown_causes)
291{
292 VALUE cause = rb_attr_get(errinfo, id_cause);
293 if (!NIL_P(cause) && rb_obj_is_kind_of(cause, rb_eException) &&
294 !shown_cause_p(cause, shown_causes)) {
295 volatile VALUE eclass = CLASS_OF(cause);
296 VALUE errat = rb_get_backtrace(cause);
297 VALUE emesg = rb_get_detailed_message(cause, opt);
298 if (reverse) {
299 show_cause(cause, str, opt, highlight, reverse, backtrace_limit, shown_causes);
300 print_backtrace(eclass, errat, str, TRUE, backtrace_limit);
301 print_errinfo(eclass, errat, emesg, str, RTEST(highlight));
302 }
303 else {
304 print_errinfo(eclass, errat, emesg, str, RTEST(highlight));
305 print_backtrace(eclass, errat, str, FALSE, backtrace_limit);
306 show_cause(cause, str, opt, highlight, reverse, backtrace_limit, shown_causes);
307 }
308 }
309}
310
311void
312rb_exc_check_circular_cause(VALUE exc)
313{
314 VALUE cause = exc, shown_causes = 0;
315 do {
316 if (shown_cause_p(cause, &shown_causes)) {
317 rb_raise(rb_eArgError, "circular causes");
318 }
319 } while (!NIL_P(cause = rb_attr_get(cause, id_cause)));
320}
321
322static void
323rb_error_write0(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE opt, VALUE highlight, VALUE reverse, VALUE *shown_causes)
324{
325 volatile VALUE eclass;
326 VALUE local_shown_causes = 0;
327 long backtrace_limit = rb_backtrace_length_limit;
328
329 if (NIL_P(errinfo))
330 return;
331 if (!shown_causes) {
332 shown_causes = &local_shown_causes;
333 }
334
335 if (UNDEF_P(errat)) {
336 errat = Qnil;
337 }
338 eclass = CLASS_OF(errinfo);
339 if (reverse) {
340 static const char traceback[] = "Traceback "
341 "(most recent call last):\n";
342 const int bold_part = rb_strlen_lit("Traceback");
343 char buff[sizeof(traceback)+sizeof(bold)+sizeof(reset)-2], *p = buff;
344 const char *msg = traceback;
345 long len = sizeof(traceback) - 1;
346 if (RTEST(highlight)) {
347#define APPEND(s, l) (memcpy(p, s, l), p += (l))
348 APPEND(bold, sizeof(bold)-1);
349 APPEND(traceback, bold_part);
350 APPEND(reset, sizeof(reset)-1);
351 APPEND(traceback + bold_part, sizeof(traceback)-bold_part-1);
352#undef APPEND
353 len = p - (msg = buff);
354 }
355 write_warn2(str, msg, len);
356 show_cause(errinfo, str, opt, highlight, reverse, backtrace_limit, shown_causes);
357 print_backtrace(eclass, errat, str, TRUE, backtrace_limit);
358 print_errinfo(eclass, errat, emesg, str, RTEST(highlight));
359 }
360 else {
361 print_errinfo(eclass, errat, emesg, str, RTEST(highlight));
362 print_backtrace(eclass, errat, str, FALSE, backtrace_limit);
363 show_cause(errinfo, str, opt, highlight, reverse, backtrace_limit, shown_causes);
364 }
365}
366
367void
368rb_error_write(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE opt, VALUE highlight, VALUE reverse)
369{
370 rb_error_write0(errinfo, emesg, errat, str, opt, highlight, reverse, NULL);
371}
372
373static void
374rb_ec_error_print_detailed0(rb_execution_context_t *const ec, const VALUE errinfo, const VALUE str, VALUE emesg0, VALUE *shown_causes)
375{
376 volatile uint8_t raised_flag = ec->raised_flag;
377 volatile VALUE errat = Qundef;
378 volatile bool written = false;
379 volatile VALUE emesg = emesg0;
380
381 VALUE opt = rb_hash_new();
382 VALUE highlight = rb_stderr_tty_p() ? Qtrue : Qfalse;
383 rb_hash_aset(opt, ID2SYM(rb_intern_const("highlight")), highlight);
384
385 if (NIL_P(errinfo))
386 return;
387 rb_ec_raised_clear(ec);
388
389 EC_PUSH_TAG(ec);
390 if (EC_EXEC_TAG() == TAG_NONE) {
391 errat = rb_get_backtrace(errinfo);
392 }
393 if (UNDEF_P(emesg)) {
394 emesg = Qnil;
395 emesg = rb_get_detailed_message(errinfo, opt);
396 }
397
398 if (!written) {
399 written = true;
400 rb_error_write0(errinfo, emesg, errat, str, opt, highlight, Qfalse, shown_causes);
401 }
402
403 EC_POP_TAG();
404 ec->errinfo = errinfo;
405 rb_ec_raised_set(ec, raised_flag);
406}
407
408static void
409rb_ec_error_print_detailed(rb_execution_context_t *const ec, const VALUE errinfo, const VALUE str, VALUE emesg0)
410{
411 rb_ec_error_print_detailed0(ec, errinfo, str, emesg0, NULL);
412}
413
414void
415rb_ec_error_print(rb_execution_context_t *volatile ec, volatile VALUE errinfo)
416{
417 rb_ec_error_print_detailed(ec, errinfo, Qnil, Qundef);
418}
419
420#define undef_mesg_for(v, k) rb_fstring_lit("undefined"v" method '%1$s' for "k" '%2$s'")
421#define undef_mesg(v) ( \
422 is_mod ? \
423 undef_mesg_for(v, "module") : \
424 undef_mesg_for(v, "class"))
425
426void
427rb_print_undef(VALUE klass, ID id, rb_method_visibility_t visi)
428{
429 const int is_mod = RB_TYPE_P(klass, T_MODULE);
430 VALUE mesg;
431 switch (visi & METHOD_VISI_MASK) {
432 case METHOD_VISI_UNDEF:
433 case METHOD_VISI_PUBLIC: mesg = undef_mesg(""); break;
434 case METHOD_VISI_PRIVATE: mesg = undef_mesg(" private"); break;
435 case METHOD_VISI_PROTECTED: mesg = undef_mesg(" protected"); break;
436 default: UNREACHABLE;
437 }
438 rb_name_err_raise_str(mesg, klass, ID2SYM(id));
439}
440
441void
442rb_print_undef_str(VALUE klass, VALUE name)
443{
444 const int is_mod = RB_TYPE_P(klass, T_MODULE);
445 rb_name_err_raise_str(undef_mesg(""), klass, name);
446}
447
448#define inaccessible_mesg_for(v, k) rb_fstring_lit("method '%1$s' for "k" '%2$s' is "v)
449#define inaccessible_mesg(v) ( \
450 is_mod ? \
451 inaccessible_mesg_for(v, "module") : \
452 inaccessible_mesg_for(v, "class"))
453
454void
455rb_print_inaccessible(VALUE klass, ID id, rb_method_visibility_t visi)
456{
457 const int is_mod = RB_TYPE_P(klass, T_MODULE);
458 VALUE mesg;
459 switch (visi & METHOD_VISI_MASK) {
460 case METHOD_VISI_UNDEF:
461 case METHOD_VISI_PUBLIC: mesg = inaccessible_mesg(""); break;
462 case METHOD_VISI_PRIVATE: mesg = inaccessible_mesg("private"); break;
463 case METHOD_VISI_PROTECTED: mesg = inaccessible_mesg("protected"); break;
464 default: UNREACHABLE;
465 }
466 rb_name_err_raise_str(mesg, klass, ID2SYM(id));
467}
468
469static int
470sysexit_status(VALUE err)
471{
472 VALUE st = rb_ivar_get(err, id_status);
473 return NUM2INT(st);
474}
475
476enum {
477 EXITING_WITH_MESSAGE = 1,
478 EXITING_WITH_STATUS = 2,
479 EXITING_WITH_SIGNAL = 4
480};
481static int
482exiting_split(VALUE errinfo, volatile int *exitcode, volatile int *sigstatus)
483{
484 int ex = EXIT_SUCCESS;
485 VALUE signo;
486 int sig = 0;
487 int result = 0;
488
489 if (NIL_P(errinfo)) return 0;
490
491 if (THROW_DATA_P(errinfo)) {
492 int throw_state = ((const struct vm_throw_data *)errinfo)->throw_state;
493 ex = throw_state & VM_THROW_STATE_MASK;
494 result |= EXITING_WITH_STATUS;
495 }
496 else if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
497 ex = sysexit_status(errinfo);
498 result |= EXITING_WITH_STATUS;
499 }
500 else if (rb_obj_is_kind_of(errinfo, rb_eSignal)) {
501 signo = rb_ivar_get(errinfo, id_signo);
502 sig = FIX2INT(signo);
503 result |= EXITING_WITH_SIGNAL;
504 /* no message when exiting by signal */
505 if (signo == INT2FIX(SIGSEGV) || !rb_obj_is_instance_of(errinfo, rb_eSignal))
506 /* except for SEGV and subclasses */
507 result |= EXITING_WITH_MESSAGE;
508 }
509 else if (rb_obj_is_kind_of(errinfo, rb_eSystemCallError) &&
510 FIXNUM_P(signo = rb_attr_get(errinfo, id_signo))) {
511 sig = FIX2INT(signo);
512 result |= EXITING_WITH_SIGNAL;
513 /* no message when exiting by error to be mapped to signal */
514 }
515 else {
516 ex = EXIT_FAILURE;
517 result |= EXITING_WITH_STATUS | EXITING_WITH_MESSAGE;
518 }
519
520 if (exitcode && (result & EXITING_WITH_STATUS))
521 *exitcode = ex;
522 if (sigstatus && (result & EXITING_WITH_SIGNAL))
523 *sigstatus = sig;
524
525 return result;
526}
527
528#define unknown_longjmp_status(status) \
529 rb_bug("Unknown longjmp status %d", status)
530
531static int
532error_handle_with_shown_causes(rb_execution_context_t *ec, VALUE errinfo, enum ruby_tag_type ex, VALUE *shown_causes)
533{
534 int status = EXIT_FAILURE;
535
536 if (rb_ec_set_raised(ec))
537 return EXIT_FAILURE;
538 switch (ex & TAG_MASK) {
539 case 0:
540 status = EXIT_SUCCESS;
541 break;
542
543 case TAG_RETURN:
544 error_pos(Qnil);
545 warn_print("unexpected return\n");
546 break;
547 case TAG_NEXT:
548 error_pos(Qnil);
549 warn_print("unexpected next\n");
550 break;
551 case TAG_BREAK:
552 error_pos(Qnil);
553 warn_print("unexpected break\n");
554 break;
555 case TAG_REDO:
556 error_pos(Qnil);
557 warn_print("unexpected redo\n");
558 break;
559 case TAG_RETRY:
560 error_pos(Qnil);
561 warn_print("retry outside of rescue clause\n");
562 break;
563 case TAG_THROW:
564 /* TODO: fix me */
565 error_pos(Qnil);
566 warn_print("unexpected throw\n");
567 break;
568 case TAG_RAISE:
569 if (!(exiting_split(errinfo, &status, NULL) & EXITING_WITH_MESSAGE)) {
570 break;
571 }
572 /* fallthrough */
573 case TAG_FATAL:
574 rb_ec_error_print_detailed0(ec, errinfo, Qnil, Qundef, shown_causes);
575 break;
576 default:
577 unknown_longjmp_status(ex);
578 break;
579 }
580 rb_ec_reset_raised(ec);
581 return status;
582}
583
584static int
585error_handle(rb_execution_context_t *ec, VALUE errinfo, enum ruby_tag_type ex)
586{
587 return error_handle_with_shown_causes(ec, errinfo, ex, NULL);
588}
#define T_STRING
Old name of RUBY_T_STRING.
Definition value_type.h:78
#define Qundef
Old name of RUBY_Qundef.
#define INT2FIX
Old name of RB_INT2FIX.
Definition long.h:48
#define UNREACHABLE
Old name of RBIMPL_UNREACHABLE.
Definition assume.h:28
#define ID2SYM
Old name of RB_ID2SYM.
Definition symbol.h:44
#define CLASS_OF
Old name of rb_class_of.
Definition globals.h:205
#define FIX2INT
Old name of RB_FIX2INT.
Definition int.h:41
#define T_MODULE
Old name of RUBY_T_MODULE.
Definition value_type.h:70
#define Qtrue
Old name of RUBY_Qtrue.
#define NUM2INT
Old name of RB_NUM2INT.
Definition int.h:44
#define Qnil
Old name of RUBY_Qnil.
#define Qfalse
Old name of RUBY_Qfalse.
#define NIL_P
Old name of RB_NIL_P.
#define FIXNUM_P
Old name of RB_FIXNUM_P.
VALUE rb_eSystemExit
SystemExit exception.
Definition error.c:1424
VALUE rb_eRuntimeError
RuntimeError exception.
Definition error.c:1429
VALUE rb_eException
Mother of all exceptions.
Definition error.c:1423
VALUE rb_eSysStackError
SystemStackError exception.
Definition eval.c:49
VALUE rb_eSystemCallError
SystemCallError exception.
Definition error.c:1451
VALUE rb_eSignal
SignalException exception.
Definition error.c:1426
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
Definition object.c:100
VALUE rb_obj_is_instance_of(VALUE obj, VALUE klass)
Queries if the given object is a direct instance of the given class.
Definition object.c:867
VALUE rb_obj_is_kind_of(VALUE obj, VALUE klass)
Queries if the given object is an instance (of possibly descendants) of the given class.
Definition object.c:923
ID rb_frame_callee(void)
Identical to rb_frame_this_func(), except it returns the named used to call the method.
Definition eval.c:1210
VALUE rb_hash_new(void)
Creates a new, empty hash object.
Definition hash.c:1484
#define rb_usascii_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "US ASCII" encoding.
Definition string.h:1568
#define rb_strlen_lit(str)
Length of a string literal.
Definition string.h:1693
#define rb_str_new_cstr(str)
Identical to rb_str_new, except it assumes the passed pointer is a pointer to a C string.
Definition string.h:1515
VALUE rb_ivar_get(VALUE obj, ID name)
Identical to rb_iv_get(), except it accepts the name as an ID instead of a C string.
Definition variable.c:1505
VALUE rb_class_name(VALUE obj)
Queries the name of the given object's class.
Definition variable.c:500
VALUE rb_check_funcall(VALUE recv, ID mid, int argc, const VALUE *argv)
Identical to rb_funcallv(), except it returns RUBY_Qundef instead of raising rb_eNoMethodError.
Definition vm_eval.c:686
static ID rb_intern_const(const char *str)
This is a "tiny optimisation" over rb_intern().
Definition symbol.h:285
int len
Length of the buffer.
Definition io.h:8
#define RB_GC_GUARD(v)
Prevents premature destruction of local objects.
Definition memory.h:167
#define RARRAY_LEN
Just another name of rb_array_len.
Definition rarray.h:51
#define RARRAY_AREF(a, i)
Definition rarray.h:403
#define RTEST
This is an old name of RB_TEST.
THROW_DATA.
Definition imemo.h:59
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
static bool RB_TYPE_P(VALUE obj, enum ruby_value_type t)
Queries if the given object is of given type.
Definition value_type.h:376