@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new GetDefinedConstantOrMethodInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject value = (IRubyObject) getObject().retrieve(context, self, currDynScope, temp); String name = getName().string; RubyString definedType = Helpers.getDefinedConstantOrBoundMethod(value, name); return definedType == null ? context.nil : new StringLiteral(definedType.getByteList()).retrieve(context, self, currDynScope, temp); }
public Operand run(Object[] args) { IRScope s = (IRScope)args[0]; Node n = (Node)args[1]; String name = (String)args[2]; Operand v = (n instanceof Colon2Node) ? build(((Colon2Node)n).getLeftNode(), s) : new ObjectClass(); Variable tmpVar = s.getNewTemporaryVariable(); s.addInstr(new GetDefinedConstantOrMethodInstr(tmpVar, v, new StringLiteral(name))); return tmpVar; } };
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { IRubyObject value = (IRubyObject) getObject().retrieve(context, self, currDynScope, temp); String name = getName().string; RubyString definedType = Helpers.getDefinedConstantOrBoundMethod(value, name); return definedType == null ? context.nil : new StringLiteral(definedType.getByteList()).retrieve(context, self, currDynScope, temp); }
public Operand run(Object[] args) { IRScope s = (IRScope)args[0]; Node n = (Node)args[1]; String name = (String)args[2]; Operand v = (n instanceof Colon2Node) ? build(((Colon2Node)n).getLeftNode(), s) : new ObjectClass(); Variable tmpVar = s.getNewTemporaryVariable(); s.addInstr(new GetDefinedConstantOrMethodInstr(tmpVar, v, new StringLiteral(name))); return tmpVar; } };
@Override public Instr cloneForInlining(InlinerInfo inlinerInfo) { return new GetDefinedConstantOrMethodInstr((Variable) getResult().cloneForInlining(inlinerInfo), getObject().cloneForInlining(inlinerInfo), (StringLiteral) getName().cloneForInlining(inlinerInfo)); }