/** * Used by the evaluator and the compiler to set a constant by name * This is for a null const decl */ @Deprecated public IRubyObject setConstantInCurrent(String internedName, IRubyObject result) { return getCurrentStaticScope().setConstant(internedName, result); }
/** * Used by the evaluator and the compiler to set a constant by name * This is for a null const decl */ @Deprecated public IRubyObject setConstantInCurrent(String internedName, IRubyObject result) { return getCurrentStaticScope().setConstant(internedName, result); }
public static IRubyObject setConstantInCurrent(IRubyObject value, ThreadContext context, String name) { return context.getCurrentStaticScope().setConstant(name, value); }
public static IRubyObject setConstantInCurrent(IRubyObject value, ThreadContext context, String name) { return context.getCurrentStaticScope().setConstant(name, value); }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { IRubyObject result = getValueNode().interpret(runtime, context, self, aBlock); if (constNode == null) { return context.getCurrentStaticScope().setConstant(name, result); } else if (((Node)constNode).getNodeType() == NodeType.COLON2NODE) { Node leftNode = ((Colon2Node) constNode).getLeftNode(); assert leftNode != null : "leftNode is not null"; IRubyObject obj = leftNode.interpret(runtime, context, self, aBlock); return Helpers.setConstantInModule(context, constNode.getName(), result, obj); } else { // colon3 return Helpers.setConstantInModule(context, constNode.getName(), result, runtime.getObject()); } }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { IRubyObject result = getValueNode().interpret(runtime, context, self, aBlock); if (constNode == null) { return context.getCurrentStaticScope().setConstant(name, result); } else if (((Node)constNode).getNodeType() == NodeType.COLON2NODE) { Node leftNode = ((Colon2Node) constNode).getLeftNode(); assert leftNode != null : "leftNode is not null"; IRubyObject obj = leftNode.interpret(runtime, context, self, aBlock); return Helpers.setConstantInModule(context, constNode.getName(), result, obj); } else { // colon3 return Helpers.setConstantInModule(context, constNode.getName(), result, runtime.getObject()); } }