/** * Called by the {@link ARecordModifier} node from {@link ARecordModifier#apply(IAnalysis)}. * @param node the calling {@link ARecordModifier} node */ public void caseARecordModifier(ARecordModifier node, Q question) throws AnalysisException { _visitedNodes.add(node); inARecordModifier(node, question); if(node.getTag() != null ) { node.getTag().apply(this, question); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this, question); } outARecordModifier(node, question); }
/** * Called by the {@link ARecordModifier} node from {@link ARecordModifier#apply(IAnalysis)}. * @param node the calling {@link ARecordModifier} node */ public void caseARecordModifier(ARecordModifier node) throws AnalysisException { _visitedNodes.add(node); inARecordModifier(node); if(node.getTag() != null ) { node.getTag().apply(this); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this); } outARecordModifier(node); }
/** * Called by the {@link ARecordModifier} node from {@link ARecordModifier#apply(IPOFAnalysis)}. * @param node the calling {@link ARecordModifier} node */ public void caseARecordModifier(ARecordModifier node) throws AnalysisException { _visitedNodes.add(node); inARecordModifier(node); if(node.getTag() != null ) { node.getTag().apply(this); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { node.getValue().apply(this); } outARecordModifier(node); }
/** * Called by the {@link ARecordModifier} node from {@link ARecordModifier#apply(IAnalysis)}. * @param node the calling {@link ARecordModifier} node */ public A caseARecordModifier(ARecordModifier node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inARecordModifier(node)); if(node.getTag() != null ) { mergeReturns(retVal,node.getTag().apply(this)); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outARecordModifier(node)); return retVal; }
/** * Called by the {@link ARecordModifier} node from {@link ARecordModifier#apply(IAnalysis)}. * @param node the calling {@link ARecordModifier} node */ public A caseARecordModifier(ARecordModifier node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inARecordModifier(node, question)); if(node.getTag() != null ) { mergeReturns(retVal,node.getTag().apply(this, question)); } if(node.getValue() != null && !_visitedNodes.contains(node.getValue())) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outARecordModifier(node, question)); return retVal; }
@Override public SModifierIR caseARecordModifier(ARecordModifier node, IRInfo question) throws AnalysisException { ILexIdentifierToken tag = node.getTag(); PExp value = node.getValue(); String name = tag.getName(); SExpIR recCg = value.apply(question.getExpVisitor(), question); ARecordModifierIR recModifier = new ARecordModifierIR(); recModifier.setName(name); recModifier.setValue(recCg); return recModifier; }
@Override public Value caseAMuExp(AMuExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); try { RecordValue r = node.getRecord().apply(VdmRuntime.getExpressionEvaluator(), ctxt).recordValue(ctxt); FieldMap fields = new FieldMap(r.fieldmap); for (ARecordModifier rm : node.getModifiers()) { AFieldField f = ctxt.assistantFactory.createARecordInvariantTypeAssistant().findField(r.type, rm.getTag().getName()); if (f == null) { VdmRuntimeError.abort(node.getLocation(), 4023, "Mu type conflict? No field tag " + rm.getTag().getName(), ctxt); } else { fields.add(rm.getTag().getName(), rm.getValue().apply(VdmRuntime.getExpressionEvaluator(), ctxt), !f.getEqualityAbstraction()); } } return new RecordValue(r.type, fields, ctxt); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
@Override // RWL See [1] pg. 56 public IProofObligationList caseAMuExp(AMuExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = node.getRecord().apply(rootVisitor, question); Queue<ARecordModifier> modifiers = node.getModifiers(); ARecordInvariantType recordType = node.getRecordType(); LinkedList<PType> mTypes = node.getModTypes(); int i = 0; for (ARecordModifier mod : modifiers) { obligations.addAll(mod.getValue().apply(mainVisitor, question)); AFieldField f = findField(recordType, mod.getTag()); PType mType = mTypes.get(i++); if (f != null) { if (!aF.getTypeComparator().isSubType(mType, f.getType())) { TypeCompatibilityObligation sto = TypeCompatibilityObligation.newInstance(mod.getValue(), f.getType(), mType, question, aF); if (sto != null) { obligations.add(sto); } } } } return obligations; }