23 #define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
32 #define exception_error GET_VM()->special_exceptions[ruby_error_reenter]
44 static int initialized = 0;
94 void *
volatile iseq = 0;
158 volatile VALUE errs[2];
200 #if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
202 #if EXIT_SUCCESS != 0
205 #if EXIT_FAILURE != 1
212 for (nerr = 0; nerr <
numberof(errs); ++nerr) {
215 if (!
RTEST(err))
continue;
291 if (status) *status = s;
339 while (cref && cref->nd_next) {
340 VALUE klass = cref->nd_clss;
345 cref = cref->nd_next;
385 klass = cref->nd_clss;
393 cref = cref->nd_next;
405 const char *desc =
"something(?!)";
411 switch (
TYPE(klass)) {
433 volatile int line = 0;
445 if (file && !
NIL_P(mesg)) {
714 result = (*b_proc) (data1);
724 while ((eclass = va_arg(args,
VALUE)) != 0) {
736 result = (*r_proc) (data2, th->
errinfo);
808 volatile VALUE errinfo;
813 result = (*b_proc) (data1);
833 while (cfp_limit > cfp) {
834 if (cfp->
iseq == iseq)
852 if (ifunc->nd_aid)
return ifunc->nd_aid;
882 if (ifunc->nd_aid)
return ifunc->nd_aid;
922 if (!prev_cfp)
return 0;
930 if (!prev_cfp)
return 0;
956 switch (
TYPE(include)) {
980 ID id_append_features, id_included;
982 CONST_ID(id_append_features,
"append_features");
985 for (i = 0; i <
argc; i++)
988 rb_funcall(argv[argc], id_append_features, 1, module);
989 rb_funcall(argv[argc], id_included, 1, module);
1009 switch (
TYPE(prepend)) {
1033 ID id_prepend_features, id_prepended;
1035 CONST_ID(id_prepend_features,
"prepend_features");
1036 CONST_ID(id_prepended,
"prepended");
1037 for (i = 0; i <
argc; i++)
1040 rb_funcall(argv[argc], id_prepend_features, 1, module);
1041 rb_funcall(argv[argc], id_prepended, 1, module);
1049 static int warned = 0;
1053 rb_warn(
"Refinements are experimental, and the behavior may change in future versions of Ruby!");
1070 VALUE iclass,
c, superclass = klass;
1074 if (
NIL_P(cref->nd_refinements)) {
1079 cref->nd_refinements =
rb_hash_dup(cref->nd_refinements);
1085 if (
RBASIC(c)->klass == module) {
1098 while (module && module != klass) {
1123 CONST_ID(id_refinements,
"__refinements__");
1124 refinements =
rb_attr_get(module, id_refinements);
1125 if (
NIL_P(refinements))
return;
1131 ID id_refined_class;
1133 CONST_ID(id_refined_class,
"__refined_class__");
1141 VALUE iclass,
c, superclass = klass;
1146 if (
RBASIC(c)->klass == refinement) {
1157 while (refinement) {
1182 ID id_refinements, id_activated_refinements,
1183 id_refined_class, id_defined_at;
1184 VALUE refinements, activated_refinements;
1194 "can't pass a Proc as a block to Module#refine");
1197 CONST_ID(id_refinements,
"__refinements__");
1198 refinements =
rb_attr_get(module, id_refinements);
1199 if (
NIL_P(refinements)) {
1203 CONST_ID(id_activated_refinements,
"__activated_refinements__");
1204 activated_refinements =
rb_attr_get(module, id_activated_refinements);
1205 if (
NIL_P(activated_refinements)) {
1208 activated_refinements);
1211 if (
NIL_P(refinement)) {
1215 CONST_ID(id_refined_class,
"__refined_class__");
1217 CONST_ID(id_defined_at,
"__defined_at__");
1302 ID id_extend_object, id_extended;
1304 CONST_ID(id_extend_object,
"extend_object");
1308 for (i = 0; i <
argc; i++)
1311 rb_funcall(argv[argc], id_extend_object, 1, obj);
1333 rb_warning(
"main.include in the wrapped load is effective only in wrapper module");
1354 if (cref->nd_next || (prev_cfp && prev_cfp->
me)) {
1371 if (cfp->
iseq->
type == ISEQ_TYPE_RESCUE) {
1372 return &cfp->
ep[-2];
1374 else if (cfp->
iseq->
type == ISEQ_TYPE_ENSURE &&
1377 return &cfp->
ep[-2];