CallFrame* top_ruby_frame() { // Skip over any native method frames. CallFrame* cf = this; while(cf->native_method_p()) { cf = cf->previous; } return cf; }
CallFrame* VM::get_ruby_frame(ssize_t up) { CallFrame* frame = call_frame_; while(frame && up-- > 0) { frame = frame->previous; } while(frame) { if(!frame->native_method_p()) return frame; frame = frame->previous; } return NULL; }
CallFrame* VM::get_variables_frame(ssize_t up) { CallFrame* frame = call_frame_; while(frame && up-- > 0) { frame = frame->previous; } while(frame) { if(!frame->is_inline_block() && !frame->native_method_p() && frame->scope) { return frame; } frame = frame->previous; } return NULL; }
VariableScope* VariableScope::of_sender(STATE, CallFrame* call_frame) { CallFrame* dest = static_cast<CallFrame*>(call_frame->previous); // Skip any frames for native methods while(dest->native_method_p()) { dest = dest->previous; } return dest->promote_scope(state); }
Location* Location::of_closest_ruby_method(STATE, CallFrame* calling_environment) { CallFrame* dest = calling_environment->previous; // Skip any frames for native methods while(dest->native_method_p()) { dest = dest->previous; } return Location::create(state, dest, false); }