@Override public STypeIR caseARealNumericBasicType(ARealNumericBasicType node, IRInfo question) throws AnalysisException { return new ARealNumericBasicTypeIR(); }
@Override public void caseARealPatternIR(ARealPatternIR node, STypeIR question) throws AnalysisException { storeType(node, new ARealNumericBasicTypeIR()); }
public STypeIR getExpectedOperandType(SNumericBinaryExpIR node) { if (node instanceof AIntDivNumericBinaryExpIR || node instanceof AModNumericBinaryExpIR || node instanceof ARemNumericBinaryExpIR) { return new AIntNumericBasicTypeIR(); } else { return new ARealNumericBasicTypeIR(); } }
/** * Returns a deep clone of this {@link ARealNumericBasicTypeIR} node. * @return a deep clone of this {@link ARealNumericBasicTypeIR} node */ public ARealNumericBasicTypeIR clone() { return new ARealNumericBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType) ); }
/** * Creates a deep clone of this {@link ARealNumericBasicTypeIR} 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 ARealNumericBasicTypeIR} node */ public ARealNumericBasicTypeIR clone(Map<INode,INode> oldToNewMap) { ARealNumericBasicTypeIR node = new ARealNumericBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
public ARealLiteralExpIR consRealLiteral(double value) { ARealLiteralExpIR realLiteral = new ARealLiteralExpIR(); realLiteral.setType(new ARealNumericBasicTypeIR()); realLiteral.setValue(value); return realLiteral; }
} else if (pat instanceof ARealPatternIR) return new ARealNumericBasicTypeIR();
@Override public void caseADivideNumericBinaryExpIR(ADivideNumericBinaryExpIR node) throws AnalysisException { SExpIR leftExp = node.getLeft(); leftExp.apply(this); SExpIR rightExp = node.getRight(); rightExp.apply(this); if (info.getExpAssistant().isIntegerType(leftExp) && info.getExpAssistant().isIntegerType(rightExp)) { ARealLiteralExpIR one = new ARealLiteralExpIR(); ARealNumericBasicTypeIR realTypeCg = new ARealNumericBasicTypeIR(); realTypeCg.setSourceNode(new SourceNode(new ARealNumericBasicType())); one.setType(realTypeCg); one.setValue(1.0); ATimesNumericBinaryExpIR neutralMul = new ATimesNumericBinaryExpIR(); neutralMul.setType(realTypeCg.clone()); neutralMul.setLeft(one); neutralMul.setRight(leftExp); node.setLeft(info.getExpAssistant().isolateExpression(neutralMul)); } } }