private Operand[] adjustVariableDepth(Operand[] args, int depthFromSuper) { Operand[] newArgs = new Operand[args.length]; for (int i = 0; i < args.length; i++) { // Because of keyword args, we can have a keyword-arg hash in the call args. if (args[i] instanceof Hash) { newArgs[i] = ((Hash) args[i]).cloneForLVarDepth(depthFromSuper); } else { newArgs[i] = ((DepthCloneable) args[i]).cloneForDepth(depthFromSuper); } } return newArgs; }
private Operand[] adjustVariableDepth(Operand[] args, int depthFromSuper) { Operand[] newArgs = new Operand[args.length]; for (int i = 0; i < args.length; i++) { // Because of keyword args, we can have a keyword-arg hash in the call args. if (args[i] instanceof Hash) { newArgs[i] = ((Hash) args[i]).cloneForLVarDepth(depthFromSuper); } else { newArgs[i] = ((DepthCloneable) args[i]).cloneForDepth(depthFromSuper); } } return newArgs; }
public Operand cloneForLVarDepth(int newDepth) { KeyValuePair<Operand, Operand>[] newPairs = Arrays.stream(pairs) .map(pair -> new KeyValuePair( pair.getKey(), ((DepthCloneable) pair.getValue()).cloneForDepth(newDepth))) .toArray(n -> new KeyValuePair[n]); return new Hash(newPairs, isKWArgsHash); }
public Operand cloneForLVarDepth(int newDepth) { KeyValuePair<Operand, Operand>[] newPairs = Arrays.stream(pairs) .map(pair -> new KeyValuePair( pair.getKey(), ((DepthCloneable) pair.getValue()).cloneForDepth(newDepth))) .toArray(n -> new KeyValuePair[n]); return new Hash(newPairs, isKWArgsHash); }