@Override public Instr cloneForInlining(InlinerInfo ii) { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), array.cloneForInlining(ii), preArgsCount, postArgsCount, index); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), array.cloneForInlining(ii), preArgsCount, postArgsCount, index); }
@Override public Instr clone(CloneInfo ii) { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), getArray().cloneForInlining(ii), preArgsCount, postArgsCount, index); }
@Override public Instr clone(CloneInfo ii) { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), getArray().cloneForInlining(ii), preArgsCount, postArgsCount, index); }
public static ReqdArgMultipleAsgnInstr decode(IRReaderDecoder d) { return new ReqdArgMultipleAsgnInstr(d.decodeVariable(), d.decodeOperand(), d.decodeInt(), d.decodeInt(), d.decodeInt()); }
public static ReqdArgMultipleAsgnInstr decode(IRReaderDecoder d) { return new ReqdArgMultipleAsgnInstr(d.decodeVariable(), d.decodeOperand(), d.decodeInt(), d.decodeInt(), d.decodeInt()); }
protected void receiveBlockArg(Variable v, Operand argsArray, int argIndex, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes addInstr(isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex)); } }
protected void receiveBlockArg(Variable v, Operand argsArray, int argIndex, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes addInstr(isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex)); } }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { return new CopyInstr(ii.getRenamedVariable(result), ii.getArg(argIndex)); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), -1, -1, argIndex); } }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { return new CopyInstr(ii.getRenamedVariable(result), ii.getArg(argIndex)); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), -1, -1, argIndex); } }
protected void receiveBlockArg(IRScope s, Variable v, Operand argsArray, int argIndex, boolean isClosureArg, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) s.addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else s.addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes s.addInstr(isClosureArg ? new ReceiveClosureInstr(v) : (isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex))); } }
protected void receiveBlockArg(IRScope s, Variable v, Operand argsArray, int argIndex, boolean isClosureArg, boolean isSplat) { if (argsArray != null) { // We are in a nested receive situation -- when we are not at the root of a masgn tree // Ex: We are trying to receive (b,c) in this example: "|a, (b,c), d| = ..." if (isSplat) s.addInstr(new RestArgMultipleAsgnInstr(v, argsArray, argIndex)); else s.addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, argIndex)); } else { // argsArray can be null when the first node in the args-node-ast is a multiple-assignment // For example, for-nodes s.addInstr(isClosureArg ? new ReceiveClosureInstr(v) : (isSplat ? new ReceiveRestArgInstr(v, argIndex, argIndex) : new ReceivePreReqdArgInstr(v, argIndex))); } }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) return new ReceivePreReqdArgInstr(info.getRenamedVariable(result), argIndex); InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.canMapArgsStatically()) return new CopyInstr(ii.getRenamedVariable(result), ii.getArg(argIndex)); return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), -1, -1, argIndex); }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) return new ReceivePreReqdArgInstr(info.getRenamedVariable(result), argIndex); InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.canMapArgsStatically()) return new CopyInstr(ii.getRenamedVariable(result), ii.getArg(argIndex)); return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), -1, -1, argIndex); }
v = getArgVariable(dynamicAsgn.getName(), dynamicAsgn.getDepth()); if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); break; v = getArgVariable(localVariable.getName(), localVariable.getDepth()); if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); break; v = createTemporaryVariable(); if (isSplat) addInstr(new RestArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); else addInstr(new ReqdArgMultipleAsgnInstr(v, argsArray, preArgsCount, postArgsCount, index)); Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, v));
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getInlineHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); } }
@Override public Instr cloneForInlinedScope(InlinerInfo ii) { if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getInlineHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } else { return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); } }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) { return new ReceivePostReqdArgInstr(info.getRenamedVariable(result), argIndex, preReqdArgsCount, optArgsCount, restArg, postReqdArgsCount); } InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) { return new ReceivePostReqdArgInstr(info.getRenamedVariable(result), argIndex, preReqdArgsCount, optArgsCount, restArg, postReqdArgsCount); } InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.canMapArgsStatically()) { int n = ii.getArgsCount(); int remaining = n - preReqdArgsCount; Operand argVal; if (remaining <= argIndex) { // SSS: FIXME: Argh! argVal = ii.getHostScope().getManager().getNil(); } else { argVal = (remaining > postReqdArgsCount) ? ii.getArg(n - postReqdArgsCount + argIndex) : ii.getArg(preReqdArgsCount + argIndex); } return new CopyInstr(ii.getRenamedVariable(result), argVal); } return new ReqdArgMultipleAsgnInstr(ii.getRenamedVariable(result), ii.getArgs(), preReqdArgsCount, postReqdArgsCount, argIndex); }
} else { Variable rhsVal = s.getNewTemporaryVariable(); s.addInstr(new ReqdArgMultipleAsgnInstr(rhsVal, values, i)); buildAssignment(an, s, rhsVal);