@Override public SExpIR caseATimesNumericBinaryExp(ATimesNumericBinaryExp node, IRInfo question) throws AnalysisException { return question.getExpAssistant().handleBinaryExp(node, new ATimesNumericBinaryExpIR(), question); }
/** * Creates a deep clone of this {@link ATimesNumericBinaryExpIR} 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 ATimesNumericBinaryExpIR} node */ public ATimesNumericBinaryExpIR clone(Map<INode,INode> oldToNewMap) { ATimesNumericBinaryExpIR node = new ATimesNumericBinaryExpIR( _sourceNode, _tag, _metaData, cloneNode(_type, oldToNewMap), cloneNode(_left, oldToNewMap), cloneNode(_right, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Returns a deep clone of this {@link ATimesNumericBinaryExpIR} node. * @return a deep clone of this {@link ATimesNumericBinaryExpIR} node */ public ATimesNumericBinaryExpIR clone() { return new ATimesNumericBinaryExpIR( _sourceNode, _tag, _metaData, cloneNode(_type), cloneNode(_left), cloneNode(_right) ); }
@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)); } } }