static inline VALUE vm_getspecial(rb_thread_t *th, VALUE *lfp, rb_num_t key, rb_num_t type) { VALUE val; if (type == 0) { val = lfp_svar_get(th, lfp, key); } else { VALUE backref = lfp_svar_get(th, lfp, 1); if (type & 0x01) { switch (type >> 1) { case '&': val = rb_reg_last_match(backref); break; case '`': val = rb_reg_match_pre(backref); break; case '\'': val = rb_reg_match_post(backref); break; case '+': val = rb_reg_match_last(backref); break; default: rb_bug("unexpected back-ref"); } } else { val = rb_reg_nth_match((int)(type >> 1), backref); } }
static VALUE vm_cfp_svar_get(rb_thread_t *th, rb_control_frame_t *cfp, VALUE key) { cfp = vm_normal_frame(th, cfp); return lfp_svar_get(th, cfp ? cfp->lfp : 0, key); }