@Override public SExpIR caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { return node.getObject().apply(this); }
private boolean isObjOfFieldExp(AFieldExpIR node) { return node.parent() instanceof AFieldExpIR && ((AFieldExpIR) node.parent()).getObject() == node; }
/** * Called by the {@link AFieldExpIR} node from {@link AFieldExpIR#apply(IIsaAnalysis)}. * @param node the calling {@link AFieldExpIR} node */ public void caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { _visitedNodes.add(node); inAFieldExpIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this); } outAFieldExpIR(node); }
/** * Called by the {@link AFieldExpIR} node from {@link AFieldExpIR#apply(IAnalysis)}. * @param node the calling {@link AFieldExpIR} node */ public void caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { _visitedNodes.add(node); inAFieldExpIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this); } outAFieldExpIR(node); }
/** * Called by the {@link AFieldExpIR} node from {@link AFieldExpIR#apply(IAnalysis)}. * @param node the calling {@link AFieldExpIR} node */ public void caseAFieldExpIR(AFieldExpIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAFieldExpIR(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { node.getObject().apply(this, question); } outAFieldExpIR(node, question); }
public SExpIR findSubject(SExpIR next) { while (next instanceof AFieldExpIR || next instanceof AMapSeqGetExpIR || next instanceof AApplyExpIR) { if (next instanceof AFieldExpIR) { next = ((AFieldExpIR) next).getObject(); } else if (next instanceof AMapSeqGetExpIR) { next = ((AMapSeqGetExpIR) next).getCol(); } else if (next instanceof AApplyExpIR) { next = ((AApplyExpIR) next).getRoot(); } } return next; }
/** * Called by the {@link AFieldExpIR} node from {@link AFieldExpIR#apply(IAnalysis)}. * @param node the calling {@link AFieldExpIR} node */ public A caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAFieldExpIR(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { mergeReturns(retVal,node.getObject().apply(this)); } mergeReturns(retVal,outAFieldExpIR(node)); return retVal; }
/** * Called by the {@link AFieldExpIR} node from {@link AFieldExpIR#apply(IAnalysis)}. * @param node the calling {@link AFieldExpIR} node */ public A caseAFieldExpIR(AFieldExpIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAFieldExpIR(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getObject() != null && !_visitedNodes.contains(node.getObject())) { mergeReturns(retVal,node.getObject().apply(this, question)); } mergeReturns(retVal,outAFieldExpIR(node, question)); return retVal; }
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; }
@Override public void caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { // Examples new IO().ferror() or myIoObj.ferror() STypeIR objType = node.getObject().getType(); if(objType instanceof AClassTypeIR) { AClassTypeIR classType = (AClassTypeIR) objType; String className = classType.getName(); String member = node.getMemberName(); if(isUnsupportedIO(className, member) || isUnsupportedVDMUtil(className, member)){ warn(node); } } }
@Override public void caseAAssignToExpStmIR(AAssignToExpStmIR node) throws AnalysisException { if (node.getTarget() instanceof AFieldExpIR) { AFieldExpIR field = (AFieldExpIR) node.getTarget(); if (field.getObject().getType() instanceof AUnionTypeIR) { if (p != null) { log.error("Expected no state designator data by now"); } p = this.stateDesInfo.remove(node); handAssignRighHandSide(node); handleAssignTarget(node); } } else { handAssignRighHandSide(node); } p = null; }
@Override public void caseAFieldExpIR(AFieldExpIR node) throws AnalysisException { SExpIR object = node.getObject(); STypeIR objectType = object.getType(); if (!(objectType instanceof AUnionTypeIR)) { object.apply(this); return; } STypeIR resultType = getResultType(node, node.parent(), objectType, transAssistant.getInfo().getTypeAssistant()); handleFieldExp(node, node.getMemberName(), object, objectType, resultType); }
fieldName = fieldExp.getMemberName(); STypeIR classType = ((AFieldExpIR) root).getObject().getType();
private SExpIR consRecFieldExp(AIdentifierVarExpIR patternVar, int i, STypeIR currentType, boolean cast) { ARecordTypeIR recordType = (ARecordTypeIR) patternVar.getType(); AFieldDeclIR recordField = transAssistant.getInfo().getAssistantManager().getDeclAssistant().getFieldDecl(transAssistant.getInfo().getClasses(), recordType, i); String fieldName = recordField.getName(); AFieldExpIR fieldExp = consRecFieldExp(patternVar, currentType, fieldName); if (cast) { ACastUnaryExpIR casted = new ACastUnaryExpIR(); casted.setType(recordType.clone()); casted.setExp(fieldExp.getObject()); fieldExp.setObject(casted); } return fieldExp; }
@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); } }
List<ARecordTypeIR> recTypes = getTypes(exp.getObject().getType(), ARecordTypeIR.class); String memberName = exp.getMemberName(); List<SClassDeclIR> classes = javaFormat.getIrInfo().getClasses();