/** * Creates a new complete constructor {@code AIfStmIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param ifExp_ the {@link SExpIR} node for the {@code ifExp} child of this {@link AIfStmIR} node * @param thenStm_ the {@link SStmIR} node for the {@code thenStm} child of this {@link AIfStmIR} node * @param elseIf_ the {@link NodeList} node for the {@code elseIf} child of this {@link AIfStmIR} node * @param elseStm_ the {@link SStmIR} node for the {@code elseStm} child of this {@link AIfStmIR} node */ public AIfStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SExpIR ifExp_, SStmIR thenStm_, List<? extends AElseIfStmIR> elseIf_, SStmIR elseStm_) { super(sourceNode_,tag_,metaData_); this.setIfExp(ifExp_); this.setThenStm(thenStm_); this.setElseIf(elseIf_); this.setElseStm(elseStm_); }
/** * Creates a new tree field only constructor {@code AIfStmIR TAG=if} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param ifExp_ the {@link SExpIR} node for the {@code ifExp} child of this {@link AIfStmIR} node * @param thenStm_ the {@link SStmIR} node for the {@code thenStm} child of this {@link AIfStmIR} node * @param elseIf_ the {@link NodeList} node for the {@code elseIf} child of this {@link AIfStmIR} node * @param elseStm_ the {@link SStmIR} node for the {@code elseStm} child of this {@link AIfStmIR} node */ public AIfStmIR(SExpIR ifExp_, SStmIR thenStm_, List<? extends AElseIfStmIR> elseIf_, SStmIR elseStm_) { super(null,null,null); this.setIfExp(ifExp_); this.setThenStm(thenStm_); this.setElseIf(elseIf_); this.setElseStm(elseStm_); }
block.getStatements().add(elsePart); elsePart.setElseStm(enclosingIf.getElseStm()); enclosingIf.setElseStm(block);
ifStm.setElseStm(nodeCases.get(0).getResult().clone()); nextCase.setElseStm(currentCase.getResult().clone()); noMatchStm.setError(matchFail); ifStm.setElseStm(noMatchStm); nextCase.setElseStm(node.getOthers().clone());
ifChecks.setElseStm(consRaiseStm(MISSING_MEMBER, field.getMemberName()));
@Override public void inATernaryIfExpIR(ATernaryIfExpIR node) throws AnalysisException { INode parent = node.parent(); if (parent instanceof AReturnStmIR) { AIfStmIR ifStm = new AIfStmIR(); ifStm.setSourceNode(node.getSourceNode()); ifStm.setIfExp(node.getCondition().clone()); AReturnStmIR thenStm = new AReturnStmIR(); thenStm.setExp(node.getTrueValue().clone()); ifStm.setThenStm(thenStm); AReturnStmIR elseStm = new AReturnStmIR(); elseStm.setExp(node.getFalseValue().clone()); ifStm.setElseStm(elseStm); baseAssistant.replaceNodeWithRecursively(parent, ifStm, this); } } }
protected SStmIR consOrExpCheck(AOrBoolBinaryExpIR node, String orResultVarName) { SExpIR left = node.getLeft().clone(); SExpIR right = node.getRight().clone(); AIfStmIR leftCheck = new AIfStmIR(); leftCheck.setIfExp(left); AAssignToExpStmIR setOrResultVarTrue = new AAssignToExpStmIR(); setOrResultVarTrue.setTarget(transAssistant.consBoolCheck(orResultVarName, false)); setOrResultVarTrue.setExp(transAssistant.getInfo().getAssistantManager().getExpAssistant().consBoolLiteral(true)); leftCheck.setThenStm(setOrResultVarTrue); AAssignToExpStmIR setOrResultVarToRightExp = new AAssignToExpStmIR(); setOrResultVarToRightExp.setTarget(transAssistant.consBoolCheck(orResultVarName, false)); setOrResultVarToRightExp.setExp(right); leftCheck.setElseStm(setOrResultVarToRightExp); return leftCheck; }
@Override public SStmIR caseAIfStm(AIfStm node, IRInfo question) throws AnalysisException { SExpIR ifExp = node.getIfExp().apply(question.getExpVisitor(), question); SStmIR thenStm = node.getThenStm().apply(question.getStmVisitor(), question); AIfStmIR ifStm = new AIfStmIR(); ifStm.setIfExp(ifExp); ifStm.setThenStm(thenStm); LinkedList<AElseIfStm> elseIfs = node.getElseIf(); for (AElseIfStm stm : elseIfs) { ifExp = stm.getElseIf().apply(question.getExpVisitor(), question); thenStm = stm.getThenStm().apply(question.getStmVisitor(), question); AElseIfStmIR elseIfStm = new AElseIfStmIR(); elseIfStm.setElseIf(ifExp); elseIfStm.setThenStm(thenStm); ifStm.getElseIf().add(elseIfStm); } if (node.getElseStm() != null) { SStmIR elseStm = node.getElseStm().apply(question.getStmVisitor(), question); ifStm.setElseStm(elseStm); } return ifStm; }
setFalse.setTarget(patternData.getSuccessVar().clone()); setFalse.setExp(transAssistant.getInfo().getExpAssistant().consBoolLiteral(false)); ifStm.setElseStm(setFalse);
ifStm.setIfExp(condition.clone()); ifStm.setThenStm(trueBranch); ifStm.setElseStm(falseBranch);
matchesCheck.setIfExp(tooManyMatches); matchesCheck.setThenStm(consIotaMultipleResultsError()); matchesCheck.setElseStm(resultAssign);
ifChecks.setElseStm(raise);
bodyif.setElseStm(ret.clone());
ifChecks.setElseStm(raiseStm);