package org.jruby.ir.transformations.inlining;
import org.jruby.ir.IRScope;
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.LocalVariable;
import org.jruby.ir.operands.Variable;
public class SimpleCloneInfo extends CloneInfo {
private boolean isEnsureBlock;
private boolean cloneIPC;
public SimpleCloneInfo(IRScope scope, boolean isEnsureBlock, boolean cloneIPC) {
super(scope);
this.isEnsureBlock = isEnsureBlock;
}
public SimpleCloneInfo(IRScope scope, boolean isEnsureBlock) {
this(scope, isEnsureBlock, false);
}
public boolean isEnsureBlockCloneMode() {
return this.isEnsureBlock;
}
public boolean shouldCloneIPC() {
return cloneIPC;
}
public Variable getRenamedVariable(Variable variable) {
Variable renamed = super.getRenamedVariable(variable);
if (variable instanceof LocalVariable && !((LocalVariable) variable).isSameDepth((LocalVariable) renamed)) {
return ((LocalVariable) renamed).cloneForDepth(((LocalVariable) variable).getScopeDepth());
}
return renamed;
}
protected Label getRenamedLabelSimple(Label l) {
return isEnsureBlock ? l : l.clone();
}
public Variable getRenamedSelfVariable(Variable self) {
return self;
}
protected Variable getRenamedVariableSimple(Variable v) {
return v.clone(this);
}
public void renameLabel(Label l) {
labelRenameMap.put(l, getScope().getNewLabel());
}
}