return Node.createList(beginNode, endNode);
}
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
DynamicScope scope = context.getCurrentScope();
IRubyObject nil = runtime.getNil();
int index = getIndex();
// Make sure the appropriate scope has proper size. See JRUBY-2046.
DynamicScope flipScope = scope.getFlipScope();
flipScope.growIfNeeded();
IRubyObject result = flipScope.getValueDepthZeroOrNil(index, nil);
if (exclusive) {
if (result == null || !result.isTrue()) {
result = trueIfTrue(runtime, beginNode.interpret(runtime, context, self, aBlock));
flipScope.setValueDepthZero(result, index);
return result;
} else {
if (endNode.interpret(runtime, context, self, aBlock).isTrue()) {
flipScope.setValueDepthZero(runtime.getFalse(), index);
}
return runtime.getTrue();
}
} else {
if (result == null || !result.isTrue()) {
if (beginNode.interpret(runtime, context, self, aBlock).isTrue()) {
flipScope.setValueDepthZero(falseIfTrue(runtime, endNode.interpret(runtime, context, self, aBlock)), index);
return runtime.getTrue();
}
return runtime.getFalse();
} else {
if (endNode.interpret(runtime, context, self, aBlock).isTrue()) {
flipScope.setValueDepthZero(runtime.getFalse(), index);
}
return runtime.getTrue();
}
}
}