package org.jruby.internal.runtime.methods;
import org.jruby.RubyModule;
import org.jruby.ir.IRScope;
import org.jruby.ir.interpreter.InterpreterContext;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.runtime.Block;
import org.jruby.runtime.DynamicScope;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
public class InterpretedIRMetaClassBody extends InterpretedIRBodyMethod {
public InterpretedIRMetaClassBody(IRScope metaClassBody, RubyModule implementationClass) {
super(metaClassBody, implementationClass);
}
@Override
protected void post(InterpreterContext ic, ThreadContext context) {
context.popFrame();
if (ic.popDynScope()) {
context.popScope();
}
}
@Override
protected void pre(InterpreterContext ic, ThreadContext context, IRubyObject self, String name, Block block, RubyModule implClass) {
context.preMethodFrameOnly(getImplementationClass(), name, self, getVisibility(), block);
if (ic.pushNewDynScope()) {
context.pushScope(DynamicScope.newDynamicScope(ic.getStaticScope(), context.getCurrentScope()));
}
}
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, Block block) {
if (IRRuntimeHelpers.isDebug()) doDebug();
return callInternal(context, self, clazz, name, block);
}
}