private Operand processEnsureRescueBlocks(Operand retVal) { // Before we return, // - have to go execute all the ensure blocks if there are any. // this code also takes care of resetting "$!" if (!activeEnsureBlockStack.empty()) { retVal = addResultInstr(new CopyInstr(createTemporaryVariable(), retVal)); emitEnsureBlocks(null); } return retVal; }
private Operand processEnsureRescueBlocks(Operand retVal) { // Before we return, // - have to go execute all the ensure blocks if there are any. // this code also takes care of resetting "$!" if (!activeEnsureBlockStack.empty()) { retVal = addResultInstr(new CopyInstr(createTemporaryVariable(), retVal)); emitEnsureBlocks(null); } return retVal; }
public Operand buildBackref(Variable result, BackRefNode node) { if (result == null) result = createTemporaryVariable(); return addResultInstr(new BuildBackrefInstr(result, node.getType())); }
public Operand buildBackref(Variable result, BackRefNode node) { if (result == null) result = createTemporaryVariable(); return addResultInstr(new BuildBackrefInstr(result, node.getType())); }
public Operand buildMatch(Variable result, MatchNode matchNode) { Operand regexp = build(matchNode.getRegexpNode()); Variable tempLastLine = createTemporaryVariable(); addResultInstr(new GetGlobalVariableInstr(tempLastLine, symbol("$_"))); if (result == null) result = createTemporaryVariable(); return addResultInstr(new MatchInstr(scope, result, regexp, tempLastLine)); }
public Operand buildMatch(Variable result, MatchNode matchNode) { Operand regexp = build(matchNode.getRegexpNode()); Variable tempLastLine = createTemporaryVariable(); addResultInstr(new GetGlobalVariableInstr(tempLastLine, symbol("$_"))); if (result == null) result = createTemporaryVariable(); return addResultInstr(new MatchInstr(scope, result, regexp, tempLastLine)); }
public Operand buildUndef(Node node) { Operand methName = build(((UndefNode) node).getName()); return addResultInstr(new UndefMethodInstr(createTemporaryVariable(), methName)); }
public Operand buildVCall(Variable result, VCallNode node) { if (result == null) result = createTemporaryVariable(); return addResultInstr(CallInstr.create(scope, CallType.VARIABLE, result, node.getName(), buildSelf(), NO_ARGS, null)); }
private void outputExceptionCheck(Operand excType, Operand excObj, Label caughtLabel) { Variable eqqResult = addResultInstr(new RescueEQQInstr(createTemporaryVariable(), excType, excObj)); addInstr(createBranch(eqqResult, manager.getTrue(), caughtLabel)); }
public Operand buildMatch3(Variable result, Match3Node matchNode) { Operand receiver = build(matchNode.getReceiverNode()); Operand value = build(matchNode.getValueNode()); if (result == null) result = createTemporaryVariable(); return addResultInstr(new MatchInstr(scope, result, receiver, value)); }
public Operand buildArgsPush(final ArgsPushNode node) { Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); return addResultInstr(new BuildCompoundArrayInstr(createTemporaryVariable(), lhs, rhs, true)); }
public Operand buildMatch3(Variable result, Match3Node matchNode) { Operand receiver = build(matchNode.getReceiverNode()); Operand value = build(matchNode.getValueNode()); if (result == null) result = createTemporaryVariable(); return addResultInstr(new MatchInstr(scope, result, receiver, value)); }
public Operand buildArgsCat(final ArgsCatNode argsCatNode) { Operand lhs = build(argsCatNode.getFirstNode()); Operand rhs = build(argsCatNode.getSecondNode()); return addResultInstr(new BuildCompoundArrayInstr(createTemporaryVariable(), lhs, rhs, false)); }
public Operand buildArgsCat(final ArgsCatNode argsCatNode) { Operand lhs = build(argsCatNode.getFirstNode()); Operand rhs = build(argsCatNode.getSecondNode()); return addResultInstr(new BuildCompoundArrayInstr(createTemporaryVariable(), lhs, rhs, false)); }
public Operand buildArgsPush(final ArgsPushNode node) { Operand lhs = build(node.getFirstNode()); Operand rhs = build(node.getSecondNode()); return addResultInstr(new BuildCompoundArrayInstr(createTemporaryVariable(), lhs, rhs, true)); }
public Operand buildModule(ModuleNode moduleNode) { Colon3Node cpath = moduleNode.getCPath(); RubySymbol moduleName = cpath.getName(); Operand container = getContainerFromCPath(cpath); IRModuleBody body = new IRModuleBody(manager, scope, moduleName, moduleNode.getLine(), moduleNode.getScope()); Variable moduleVar = addResultInstr(new DefineModuleInstr(createTemporaryVariable(), body, container)); Variable processBodyResult = addResultInstr(new ProcessModuleBodyInstr(createTemporaryVariable(), moduleVar, NullBlock.INSTANCE)); newIRBuilder(manager, body).buildModuleOrClassBody(moduleNode.getBodyNode(), moduleNode.getLine(), moduleNode.getEndLine()); return processBodyResult; }
public Operand buildSClass(SClassNode sclassNode) { Operand receiver = build(sclassNode.getReceiverNode()); // FIXME: metaclass name should be a bytelist IRModuleBody body = new IRMetaClassBody(manager, scope, manager.getMetaClassName(), sclassNode.getLine(), sclassNode.getScope()); Variable sClassVar = addResultInstr(new DefineMetaClassInstr(createTemporaryVariable(), receiver, body)); // sclass bodies inherit the block of their containing method Variable processBodyResult = addResultInstr(new ProcessModuleBodyInstr(createTemporaryVariable(), sClassVar, scope.getYieldClosureVariable())); newIRBuilder(manager, body).buildModuleOrClassBody(sclassNode.getBodyNode(), sclassNode.getLine(), sclassNode.getEndLine()); return processBodyResult; }
public Operand buildSClass(SClassNode sclassNode) { Operand receiver = build(sclassNode.getReceiverNode()); // FIXME: metaclass name should be a bytelist IRModuleBody body = new IRMetaClassBody(manager, scope, manager.getMetaClassName(), sclassNode.getLine(), sclassNode.getScope()); Variable sClassVar = addResultInstr(new DefineMetaClassInstr(createTemporaryVariable(), receiver, body)); // sclass bodies inherit the block of their containing method Variable processBodyResult = addResultInstr(new ProcessModuleBodyInstr(createTemporaryVariable(), sClassVar, scope.getYieldClosureVariable())); newIRBuilder(manager, body).buildModuleOrClassBody(sclassNode.getBodyNode(), sclassNode.getLine(), sclassNode.getEndLine()); return processBodyResult; }
public Operand buildXStr(XStrNode node) { return addResultInstr(CallInstr.create(scope, CallType.FUNCTIONAL, createTemporaryVariable(), manager.getRuntime().newSymbol("`"), Self.SELF, new Operand[] { new FrozenString(node.getValue(), node.getCodeRange(), scope.getFile(), node.getLine()) }, null)); }
public Operand buildDXStr(Variable result, DXStrNode node) { Node[] nodePieces = node.children(); Operand[] pieces = new Operand[nodePieces.length]; for (int i = 0; i < pieces.length; i++) { pieces[i] = dynamicPiece(nodePieces[i]); } Variable stringResult = createTemporaryVariable(); if (result == null) result = createTemporaryVariable(); boolean debuggingFrozenStringLiteral = manager.getInstanceConfig().isDebuggingFrozenStringLiteral(); addInstr(new BuildCompoundStringInstr(stringResult, pieces, node.getEncoding(), false, debuggingFrozenStringLiteral, getFileName(), node.getLine())); return addResultInstr(CallInstr.create(scope, CallType.FUNCTIONAL, result, manager.getRuntime().newSymbol("`"), Self.SELF, new Operand[] { stringResult }, null)); }