30 #define exception_error GET_VM()->special_exceptions[ruby_error_reenter]
35 #define CLASS_OR_MODULE_P(obj) \
36 (!SPECIAL_CONST_P(obj) && \
37 (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
46 static int initialized = 0;
96 void *
volatile iseq = 0;
160 volatile VALUE errs[2];
196 #if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
198 #if EXIT_SUCCESS != 0
201 #if EXIT_FAILURE != 1
208 for (nerr = 0; nerr <
numberof(errs); ++nerr) {
211 if (!
RTEST(err))
continue;
294 if (status) *status = s;
342 while (cref && cref->nd_next) {
343 VALUE klass = cref->nd_clss;
348 cref = cref->nd_next;
388 klass = cref->nd_clss;
396 cref = cref->nd_next;
447 CONST_ID(id_true_cause,
"true_cause");
458 if (!
NIL_P(cause) && cause != exc) {
470 volatile int line = 0;
483 if (file && !
NIL_P(mesg)) {
754 result = (*b_proc) (data1);
773 while ((eclass = va_arg(args,
VALUE)) != 0) {
785 result = (*r_proc) (data2, th->
errinfo);
843 volatile VALUE errinfo;
853 result = (*b_proc) (data1);
874 while (cfp_limit > cfp) {
875 if (cfp->
iseq == iseq)
893 if (ifunc->nd_aid)
return ifunc->nd_aid;
923 if (ifunc->nd_aid)
return ifunc->nd_aid;
969 if (!prev_cfp)
return 0;
977 if (!prev_cfp)
return 0;
1015 ID id_append_features, id_included;
1017 CONST_ID(id_append_features,
"append_features");
1020 for (i = 0; i <
argc; i++)
1023 rb_funcall(argv[argc], id_append_features, 1, module);
1024 rb_funcall(argv[argc], id_included, 1, module);
1063 ID id_prepend_features, id_prepended;
1065 CONST_ID(id_prepend_features,
"prepend_features");
1066 CONST_ID(id_prepended,
"prepended");
1067 for (i = 0; i <
argc; i++)
1070 rb_funcall(argv[argc], id_prepend_features, 1, module);
1071 rb_funcall(argv[argc], id_prepended, 1, module);
1089 VALUE iclass,
c, superclass = klass;
1093 if (
NIL_P(cref->nd_refinements)) {
1104 if (
RBASIC(c)->klass == module) {
1120 while (module && module != klass) {
1142 VALUE super, module, refinements;
1154 module =
RBASIC(klass)->klass;
1162 CONST_ID(id_refinements,
"__refinements__");
1163 refinements =
rb_attr_get(module, id_refinements);
1164 if (
NIL_P(refinements))
return;
1179 ID id_refined_class;
1181 CONST_ID(id_refined_class,
"__refined_class__");
1189 VALUE iclass,
c, superclass = klass;
1194 if (
RBASIC(c)->klass == refinement) {
1205 while (refinement) {
1229 ID id_refinements, id_activated_refinements,
1230 id_refined_class, id_defined_at;
1231 VALUE refinements, activated_refinements;
1240 "can't pass a Proc as a block to Module#refine");
1243 CONST_ID(id_refinements,
"__refinements__");
1244 refinements =
rb_attr_get(module, id_refinements);
1245 if (
NIL_P(refinements)) {
1249 CONST_ID(id_activated_refinements,
"__activated_refinements__");
1250 activated_refinements =
rb_attr_get(module, id_activated_refinements);
1251 if (
NIL_P(activated_refinements)) {
1254 activated_refinements);
1257 if (
NIL_P(refinement)) {
1261 CONST_ID(id_refined_class,
"__refined_class__");
1263 CONST_ID(id_defined_at,
"__defined_at__");
1288 "Module#using is not permitted in methods");
1290 if (prev_cfp && prev_cfp->
self !=
self) {
1373 ID id_extend_object, id_extended;
1375 CONST_ID(id_extend_object,
"extend_object");
1379 for (i = 0; i <
argc; i++)
1382 rb_funcall(argv[argc], id_extend_object, 1, obj);
1403 rb_warning(
"main.include in the wrapped load is effective only in wrapper module");
1423 if (cref->nd_next || (prev_cfp && prev_cfp->
me)) {
1425 "main.using is permitted only at toplevel");
1439 if (cfp->
iseq->
type == ISEQ_TYPE_RESCUE) {
1440 return &cfp->
ep[-2];
1442 else if (cfp->
iseq->
type == ISEQ_TYPE_ENSURE &&
1445 return &cfp->
ep[-2];