@Override public STypeIR caseABooleanBasicType(ABooleanBasicType node, IRInfo question) throws AnalysisException { return new ABoolBasicTypeIR(); } }
/** * Called by the {@link ABoolBasicTypeIR} node from {@link ABoolBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ABoolBasicTypeIR} node */ public void caseABoolBasicTypeIR(ABoolBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); inABoolBasicTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outABoolBasicTypeIR(node); }
/** * Returns a deep clone of this {@link ABoolBasicTypeIR} node. * @return a deep clone of this {@link ABoolBasicTypeIR} node */ public ABoolBasicTypeIR clone() { return new ABoolBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType) ); }
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof ABoolBasicTypeIR) { return toString().equals(o.toString()); } return false; }
@Override public void caseABoolPatternIR(ABoolPatternIR node, STypeIR question) throws AnalysisException { storeType(node, new ABoolBasicTypeIR()); }
/** * Creates a deep clone of this {@link ABoolBasicTypeIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ABoolBasicTypeIR} node */ public ABoolBasicTypeIR clone(Map<INode,INode> oldToNewMap) { ABoolBasicTypeIR node = new ABoolBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ABoolBasicTypeIR} node from {@link ABoolBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ABoolBasicTypeIR} node */ public void caseABoolBasicTypeIR(ABoolBasicTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inABoolBasicTypeIR(node, question); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this, question); } outABoolBasicTypeIR(node, question); }
@Override public void inANotUnaryExpIR(ANotUnaryExpIR node) throws AnalysisException { correctTypes(node.getExp(), new ABoolBasicTypeIR()); }
/** * Called by the {@link ABoolBasicTypeIR} node from {@link ABoolBasicTypeIR#apply(IIsaAnalysis)}. * @param node the calling {@link ABoolBasicTypeIR} node */ public void caseABoolBasicTypeIR(ABoolBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); inABoolBasicTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outABoolBasicTypeIR(node); }
@Override public SExpIR getForLoopCond(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) throws AnalysisException { AClassTypeIR iteratorType = transAssistant.consClassType(ITERATOR_TYPE); return transAssistant.consInstanceCall(iteratorType, iteratorName, new ABoolBasicTypeIR(), HAS_NEXT_ELEMENT_ITERATOR); }
/** * Called by the {@link ABoolBasicTypeIR} node from {@link ABoolBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ABoolBasicTypeIR} node */ public A caseABoolBasicTypeIR(ABoolBasicTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inABoolBasicTypeIR(node, question)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this, question)); } mergeReturns(retVal,outABoolBasicTypeIR(node, question)); return retVal; }
public ABoolLiteralExpIR consBoolLiteral(boolean val) { ABoolLiteralExpIR boolLiteral = new ABoolLiteralExpIR(); boolLiteral.setType(new ABoolBasicTypeIR()); boolLiteral.setValue(val); return boolLiteral; }
/** * Called by the {@link ABoolBasicTypeIR} node from {@link ABoolBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ABoolBasicTypeIR} node */ public A caseABoolBasicTypeIR(ABoolBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inABoolBasicTypeIR(node)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this)); } mergeReturns(retVal,outABoolBasicTypeIR(node)); return retVal; }
public static ATupleIsExpIR consTupleIsExp(SExpIR exp, STypeIR checkedType) { ATupleIsExpIR tupleIsExp = new ATupleIsExpIR(); tupleIsExp.setType(new ABoolBasicTypeIR()); tupleIsExp.setExp(exp); tupleIsExp.setCheckedType(checkedType); return tupleIsExp; }
public SExpIR consAndExp(SExpIR left, SExpIR right) { AAndBoolBinaryExpIR andExp = new AAndBoolBinaryExpIR(); andExp.setType(new ABoolBasicTypeIR()); andExp.setLeft(left); andExp.setRight(right); return andExp; }
public SExpIR consBoolCheck(String boolVarName, boolean negate) { AIdentifierVarExpIR boolVarExp = new AIdentifierVarExpIR(); boolVarExp.setType(new ABoolBasicTypeIR()); boolVarExp.setIsLocal(true); boolVarExp.setName(boolVarName); if (negate) { ANotUnaryExpIR negated = new ANotUnaryExpIR(); negated.setType(new ABoolBasicTypeIR()); negated.setExp(boolVarExp); return negated; } else { return boolVarExp; } }
public static SExpIR consGeneralIsExp(SExpIR expCg, STypeIR checkedTypeCg) { AGeneralIsExpIR generalIsExp = new AGeneralIsExpIR(); generalIsExp = new AGeneralIsExpIR(); generalIsExp.setType(new ABoolBasicTypeIR()); generalIsExp.setExp(expCg); generalIsExp.setCheckedType(checkedTypeCg); return generalIsExp; }
@Override public void inAIfStmIR(AIfStmIR node) throws AnalysisException { ABoolBasicTypeIR expectedType = new ABoolBasicTypeIR(); correctTypes(node.getIfExp(), expectedType); LinkedList<AElseIfStmIR> elseIfs = node.getElseIf(); for (AElseIfStmIR currentElseIf : elseIfs) { correctTypes(currentElseIf.getElseIf(), expectedType); } }
public AIdentifierVarExpIR consSuccessVar(String successVarName) { AIdentifierVarExpIR successVar = new AIdentifierVarExpIR(); successVar.setIsLambda(false); successVar.setIsLocal(true); successVar.setName(successVarName); successVar.setType(new ABoolBasicTypeIR()); return successVar; }
public AAndBoolBinaryExpIR extendAndExp(ARecordDeclIR record, AFieldDeclIR field, SExpIR previous, String paramName) throws AnalysisException { // By recursively calling this method an "and chain" of field // comparisons can be constructed: fieldComp1 && fieldComp2 && fieldComp3 .... AAndBoolBinaryExpIR nextAnd = new AAndBoolBinaryExpIR(); nextAnd.setType(new ABoolBasicTypeIR()); nextAnd.setLeft(previous); nextAnd.setRight(consFieldComparison(record, field, paramName)); return nextAnd; }