/** * Returns a deep clone of this {@link ASetDifferenceBinaryExp} node. * @return a deep clone of this {@link ASetDifferenceBinaryExp} node */ public ASetDifferenceBinaryExp clone() { return new ASetDifferenceBinaryExp( _type, _location, cloneNode(_left), cloneNode(_op), cloneNode(_right) ); }
/** * Called by the {@link ASetDifferenceBinaryExp} node from {@link ASetDifferenceBinaryExp#apply(IPOFAnalysis)}. * @param node the calling {@link ASetDifferenceBinaryExp} node */ public void caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inASetDifferenceBinaryExp(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); } outASetDifferenceBinaryExp(node); }
@Override public PType caseASetDifferenceBinaryExp( ASetDifferenceBinaryExp node, TypeCheckInfo question) throws AnalysisException { TypeCheckInfo noConstraint = question.newConstraint(null); node.getLeft().apply(THIS, noConstraint); node.getRight().apply(THIS, noConstraint); PType ltype = node.getLeft().getType(); PType rtype = node.getRight().getType(); if (!question.assistantFactory.createPTypeAssistant().isSet(ltype)) { TypeCheckerErrors.report(3160, "Left hand of '\\' is not a set", node.getLocation(), node); } if (!question.assistantFactory.createPTypeAssistant().isSet(rtype)) { TypeCheckerErrors.report(3161, "Right hand of '\\' is not a set", node.getLocation(), node); } if (!question.assistantFactory.getTypeComparator().compatible(ltype, rtype)) { TypeCheckerErrors.report(3162, "Left and right of '\\' are different types", node.getLocation(), node); TypeCheckerErrors.detail2("Left", ltype, "Right", rtype); } if (ltype instanceof ASet1SetType) { ASet1SetType set1 = (ASet1SetType) ltype; ltype = AstFactory.newASetSetType(node.getLocation(), set1.getSetof()); } node.setType(ltype); return ltype; }
@Override public Value caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node, Context ctxt) throws AnalysisException { // breakpoint.check(location, ctxt); node.getLocation().hit(); // Mark as covered ValueSet result = new ValueSet(); ValueSet togo = null; try { togo = node.getRight().apply(VdmRuntime.getExpressionEvaluator(), ctxt).setValue(ctxt); result.addAll(node.getLeft().apply(VdmRuntime.getExpressionEvaluator(), ctxt).setValue(ctxt)); for (Value r : togo) { result.remove(r); } return new SetValue(result); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
public static ASetDifferenceBinaryExp newASetDifferenceBinaryExp(PExp left, LexToken op, PExp right) { ASetDifferenceBinaryExp result = new ASetDifferenceBinaryExp(); initExpressionBinary(result, left, op, right); return result; }
/** * Called by the {@link ASetDifferenceBinaryExp} node from {@link ASetDifferenceBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ASetDifferenceBinaryExp} node */ public void caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node) throws AnalysisException { _visitedNodes.add(node); inASetDifferenceBinaryExp(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); } outASetDifferenceBinaryExp(node); }
/** * Called by the {@link ASetDifferenceBinaryExp} node from {@link ASetDifferenceBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ASetDifferenceBinaryExp} node */ public void caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inASetDifferenceBinaryExp(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); } outASetDifferenceBinaryExp(node, question); }
/** * Creates a deep clone of this {@link ASetDifferenceBinaryExp} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ASetDifferenceBinaryExp} node */ public ASetDifferenceBinaryExp clone(Map<INode,INode> oldToNewMap) { ASetDifferenceBinaryExp node = new ASetDifferenceBinaryExp( _type, _location, cloneNode(_left, oldToNewMap), cloneNode(_op, oldToNewMap), cloneNode(_right, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ASetDifferenceBinaryExp} node from {@link ASetDifferenceBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ASetDifferenceBinaryExp} node */ public A caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inASetDifferenceBinaryExp(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,outASetDifferenceBinaryExp(node, question)); return retVal; }
/** * Called by the {@link ASetDifferenceBinaryExp} node from {@link ASetDifferenceBinaryExp#apply(IAnalysis)}. * @param node the calling {@link ASetDifferenceBinaryExp} node */ public A caseASetDifferenceBinaryExp(ASetDifferenceBinaryExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inASetDifferenceBinaryExp(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,outASetDifferenceBinaryExp(node)); return retVal; }