public AAssignToExpStmIR castFieldObj(AAssignToExpStmIR assign, AFieldExpIR target, STypeIR possibleType) { ACastUnaryExpIR cast = new ACastUnaryExpIR(); cast.setType(possibleType.clone()); cast.setExp(target.getObject().clone()); AAssignToExpStmIR assignCopy = assign.clone(); AFieldExpIR fieldCopy = target.clone(); transAssistant.replaceNodeWith(fieldCopy.getObject(), cast); transAssistant.replaceNodeWith(assignCopy.getTarget(), fieldCopy); return assignCopy; }
AVarDeclIR varDecl = dAssist.consLocalVarDecl(field.getType().clone(), id, field.clone()); varDecls.add(varDecl);
leaving.setClassType(sentinel.clone()); leaving.setType(new AVoidTypeIR()); leaving.getArgs().add(field.clone());
@Override public void caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { node.getObject().apply(this); if (node.getObject().getType() instanceof ARecordTypeIR && !(node.parent() instanceof AApplyExpIR)) { AMethodTypeIR getterType = new AMethodTypeIR(); getterType.setResult(node.getType().clone()); AFieldExpIR getterField = node.clone(); getterField.setType(getterType); AApplyExpIR getCall = new AApplyExpIR(); getCall.setRoot(getterField); getCall.setType(node.getType().clone()); getCall.setSourceNode(node.getSourceNode()); getterField.setMemberName(consGetCallName(node.getMemberName())); /** * The getters added to the record classes do not copy object references representing values. Therefore we * need to take it into account when we do the field read call */ if (cloneFieldRead(node)) { getCall = makeCopy(getCall); } jmlGen.getJavaGen().getTransAssistant().replaceNodeWith(node, getCall); } }