/** * Creates a new complete constructor {@code ARealLiteralExpIR} 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 value_ the {@link Double} node for the {@code value} child of this {@link ARealLiteralExpIR} node */ public ARealLiteralExpIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, STypeIR type_, Double value_) { super(sourceNode_,tag_,metaData_,type_); this.setValue(value_); }
/** * Creates a new tree field only constructor {@code ARealLiteralExpIR TAG=real} 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 value_ the {@link Double} node for the {@code value} child of this {@link ARealLiteralExpIR} node */ public ARealLiteralExpIR(STypeIR type_, Double value_) { super(null,null,null,type_); this.setValue(value_); }
public ARealLiteralExpIR consRealLiteral(double value) { ARealLiteralExpIR realLiteral = new ARealLiteralExpIR(); realLiteral.setType(new ARealNumericBasicTypeIR()); realLiteral.setValue(value); return realLiteral; }
@Override public SExpIR caseARealLiteralExp(ARealLiteralExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); double value = node.getValue().getValue(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ARealLiteralExpIR realLitCg = new ARealLiteralExpIR(); realLitCg.setType(typeCg); realLitCg.setValue(value); return realLitCg; }
@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)); } } }