private void genInheritanceSearchInstrs(IRScope s, Operand startingModule, Variable constVal, Label foundLabel, boolean noPrivateConstants, String name) { s.addInstr(new InheritanceSearchConstInstr(constVal, startingModule, name, noPrivateConstants)); s.addInstr(BNEInstr.create(constVal, UndefinedValue.UNDEFINED, foundLabel)); s.addInstr(new ConstMissingInstr(constVal, startingModule, name)); s.addInstr(new LabelInstr(foundLabel)); }
private void genInheritanceSearchInstrs(IRScope s, Operand startingModule, Variable constVal, Label foundLabel, boolean noPrivateConstants, String name) { s.addInstr(new InheritanceSearchConstInstr(constVal, startingModule, name, noPrivateConstants)); s.addInstr(BNEInstr.create(constVal, UndefinedValue.UNDEFINED, foundLabel)); s.addInstr(new ConstMissingInstr(constVal, startingModule, name)); s.addInstr(new LabelInstr(foundLabel)); }
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return argIndex; }
protected int receiveOptArgs(final ArgsNode argsNode, IRScope s, int opt, int argIndex) { ListNode optArgs = argsNode.getOptArgs(); for (int j = 0; j < opt; j++, argIndex++) { // Jump to 'l' if this arg is not null. If null, fall through and build the default value! Label l = s.getNewLabel(); LocalAsgnNode n = (LocalAsgnNode)optArgs.get(j); String argName = n.getName(); Variable av = s.getLocalVariable(argName, 0); if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("opt", argName); s.addInstr(new ReceiveOptArgInstr(av, argIndex-j, argIndex-j, j)); s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n, s); s.addInstr(new LabelInstr(l)); } return argIndex; }
s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, we are done build(kasgn, s); s.addInstr(new LabelInstr(l));
s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, we are done build(kasgn, s); s.addInstr(new LabelInstr(l));
s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n.getValue(), s); s.addInstr(new LabelInstr(l));
s.addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default build(n.getValue(), s); s.addInstr(new LabelInstr(l));
if (scope instanceof IRMethod) addKeyArgDesc(kasgn, key); addInstr(new ReceiveKeywordArgInstr(av, key, required)); addInstr(BNEInstr.create(l, av, UndefinedValue.UNDEFINED)); // if 'av' is not undefined, we are done
if (scope instanceof IRMethod) addKeyArgDesc(kasgn, key); addInstr(new ReceiveKeywordArgInstr(av, key, required)); addInstr(BNEInstr.create(l, av, UndefinedValue.UNDEFINED)); // if 'av' is not undefined, we are done
public Operand buildOpAsgnConstDeclNode(OpAsgnConstDeclNode node) { if (node.isOr()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, false); addInstr(BNEInstr.create(done, result, UndefinedValue.UNDEFINED)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } else if (node.isAnd()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, true); addInstr(new BFalseInstr(done, result)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } Variable result = createTemporaryVariable(); Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); addInstr(CallInstr.create(scope, result, node.getSymbolOperator(), lhs, new Operand[] { rhs }, null)); return addResultInstr(new CopyInstr(createTemporaryVariable(), putConstantAssignment(node, result))); }
public Operand buildOpAsgnConstDeclNode(OpAsgnConstDeclNode node) { if (node.isOr()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, false); addInstr(BNEInstr.create(done, result, UndefinedValue.UNDEFINED)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } else if (node.isAnd()) { Variable result = createTemporaryVariable(); Label done = getNewLabel(); Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, true); addInstr(new BFalseInstr(done, result)); Operand rhsValue = build(node.getSecondNode()); copy(result, rhsValue); addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue)); addInstr(new LabelInstr(done)); return result; } Variable result = createTemporaryVariable(); Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); addInstr(CallInstr.create(scope, result, node.getSymbolOperator(), lhs, new Operand[] { rhs }, null)); return addResultInstr(new CopyInstr(createTemporaryVariable(), putConstantAssignment(node, result))); }
Label doneLabel = s.getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(s, v); s.addInstr(BNEInstr.create(tmpVar, manager.getNil(), doneLabel)); s.addInstr(new CopyInstr(tmpVar, new StringLiteral("expression"))); s.addInstr(new LabelInstr(doneLabel));
Label doneLabel = s.getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(s, v); s.addInstr(BNEInstr.create(tmpVar, manager.getNil(), doneLabel)); s.addInstr(new CopyInstr(tmpVar, new StringLiteral("expression"))); s.addInstr(new LabelInstr(doneLabel));
addInstr(BNEInstr.create(variableAssigned, argVar, UndefinedValue.UNDEFINED));
addInstr(BNEInstr.create(variableAssigned, argVar, UndefinedValue.UNDEFINED));