private PExp getPredicate(AStarStarBinaryExp exp, ILexNameToken preName, ILexNameToken arg) { if (preName != null) { return getImplies(getVarExp(preName), exp.getLeft(), preName, arg); } else { // if no existing pre_f, build it AApplyExp applyExp = new AApplyExp(); ILexNameToken prename = new LexNameToken("", "pre_", null); applyExp.setRoot(getVarExp(prename)); List<PExp> argList = new LinkedList<PExp>(); argList.add(exp.getLeft()); applyExp.setArgs(argList); return getImplies(applyExp, exp.getLeft(), prename, arg); } }
/** * Called by the {@link AStarStarBinaryExp} node from {@link AStarStarBinaryExp#apply(IPOFAnalysis)}. * @param node the calling {@link AStarStarBinaryExp} node */ public void caseAStarStarBinaryExp(AStarStarBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inAStarStarBinaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getOp() != null ) { node.getOp().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outAStarStarBinaryExp(node); }
/** * Called by the {@link AStarStarBinaryExp} node from {@link AStarStarBinaryExp#apply(IAnalysis)}. * @param node the calling {@link AStarStarBinaryExp} node */ public void caseAStarStarBinaryExp(AStarStarBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inAStarStarBinaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getOp() != null ) { node.getOp().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outAStarStarBinaryExp(node); }
/** * Called by the {@link AStarStarBinaryExp} node from {@link AStarStarBinaryExp#apply(IAnalysis)}. * @param node the calling {@link AStarStarBinaryExp} node */ public void caseAStarStarBinaryExp(AStarStarBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAStarStarBinaryExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this, question); } if(node.getOp() != null ) { node.getOp().apply(this, question); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this, question); } outAStarStarBinaryExp(node, question); }
@Override public void caseAStarStarBinaryExp(AStarStarBinaryExp node) throws AnalysisException { PTypeAssistantTC typeAssistant = info.getTcFactory().createPTypeAssistant(); PType lType = node.getLeft().getType(); if(typeAssistant.isMap(lType)) { // Supported } else if(typeAssistant.isFunction(lType)){ info.addUnsupportedNode(node, "Function composition not supported"); } // else it's numeric (the power operator), which is supported. }
/** * Called by the {@link AStarStarBinaryExp} node from {@link AStarStarBinaryExp#apply(IAnalysis)}. * @param node the calling {@link AStarStarBinaryExp} node */ public A caseAStarStarBinaryExp(AStarStarBinaryExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAStarStarBinaryExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this)); } if(node.getOp() != null ) { mergeReturns(retVal,node.getOp().apply(this)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this)); } mergeReturns(retVal,outAStarStarBinaryExp(node)); return retVal; }
/** * Called by the {@link AStarStarBinaryExp} node from {@link AStarStarBinaryExp#apply(IAnalysis)}. * @param node the calling {@link AStarStarBinaryExp} node */ public A caseAStarStarBinaryExp(AStarStarBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAStarStarBinaryExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this, question)); } if(node.getOp() != null ) { mergeReturns(retVal,node.getOp().apply(this, question)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this, question)); } mergeReturns(retVal,outAStarStarBinaryExp(node, question)); return retVal; }
@Override public IProofObligationList caseAStarStarBinaryExp(AStarStarBinaryExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = new ProofObligationList(); PExp lExp = node.getLeft(); PType lType = lExp.getType(); if (aF.createPTypeAssistant().isFunction(lType)) { ILexNameToken preName = getPreName(lExp); if (preName == null || !preName.equals(NO_PRECONDITION)) { obligations.add(new org.overture.pog.obligation.FuncIterationObligation(node, preName, question, aF)); } } if (aF.createPTypeAssistant().isMap(lType)) { obligations.add(new MapIterationObligation(node, question, aF)); } return obligations; }
@Override public SExpIR caseAStarStarBinaryExp(AStarStarBinaryExp node, IRInfo question) throws AnalysisException { PTypeAssistantTC assist = question.getTcFactory().createPTypeAssistant(); PType lType = node.getLeft().getType(); if(assist.isMap(lType)) { return question.getExpAssistant().handleBinaryExp(node, new AMapIterationBinaryExpIR(), question); } else if(assist.isFunction(lType)) { return question.getExpAssistant().handleBinaryExp(node, new AFuncIterationBinaryExpIR(), question); } else { // So it must be numeric return question.getExpAssistant().handleBinaryExp(node, new APowerNumericBinaryExpIR(), question); } }
Value lv = node.getLeft().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref(); Value rv = node.getRight().apply(VdmRuntime.getExpressionEvaluator(), ctxt);