Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jruby.ir.instructions;
 
 import org.jruby.Ruby;
public class GetFieldInstr extends GetInstr {
    
    public GetFieldInstr(Variable destOperand objString fieldName) {
        super(.destobjfieldName);
    }
    @Override
    public Instr cloneForInlining(InlinerInfo ii) {
        return new GetFieldInstr(ii.getRenamedVariable(getResult()),
                getSource().cloneForInlining(ii), getRef());
    }
    @Override
    public Object interpret(ThreadContext contextDynamicScope currDynScopeIRubyObject selfObject[] tempBlock block) {
        Ruby runtime = context.runtime;
        IRubyObject object = (IRubyObjectgetSource().retrieve(contextselfcurrDynScopetemp);
        RubyClass cls = object.getMetaClass().getRealClass();
        VariableAccessor localAccessor = ;
        IRubyObject value;
        if (localAccessor.getClassId() != cls.hashCode()) {
            localAccessor = cls.getVariableAccessorForRead(getRef());
            if (localAccessor == nullreturn runtime.getNil();
            value = (IRubyObject)localAccessor.get(object);
             = localAccessor;
        } else {
            value = (IRubyObject)localAccessor.get(object);
        }
        return value == null ? runtime.getNil() : value;
    }
    @Override
    public void visit(IRVisitor visitor) {
        visitor.GetFieldInstr(this);
    }
New to GrepCode? Check out our FAQ X