/** * Called by the {@link ANotUnaryExp} node from {@link ANotUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ANotUnaryExp} node */ public void caseANotUnaryExp(ANotUnaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inANotUnaryExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this, question); } outANotUnaryExp(node, question); }
private PExp makeIrreflexive(PExp var, ATypeDefinition node){ ANotUnaryExp notExp = new ANotUnaryExp(); notExp.setType(new ABooleanBasicType()); PExp applyExp = makeLessWithApply(var, var, node); notExp.setExp(applyExp); return notExp; }
/** * Returns a deep clone of this {@link ANotUnaryExp} node. * @return a deep clone of this {@link ANotUnaryExp} node */ public ANotUnaryExp clone() { return new ANotUnaryExp( _type, _location, cloneNode(_exp) ); }
@Override public PType caseANotUnaryExp(ANotUnaryExp node, TypeCheckInfo question) throws AnalysisException { PExp exp = node.getExp(); question.qualifiers = null; PType t = exp.apply(THIS, question.newConstraint(null)); if (!question.assistantFactory.createPTypeAssistant().isType(t, ABooleanBasicType.class)) { TypeCheckerErrors.report(3137, "Not expression is not a boolean", node.getLocation(), node); } node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
@Override public Value caseANotUnaryExp(ANotUnaryExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); try { Value v = node.getExp().apply(VdmRuntime.getExpressionEvaluator(), ctxt); return v.isUndefined() ? v : new BooleanValue(!v.boolValue(ctxt)); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
@Override public IProofObligationList caseANotUnaryExp(ANotUnaryExp node, IPOContextStack question) throws AnalysisException { return node.getExp().apply(mainVisitor, question); }
private PExp getCaseExp() { if (assistantFactory.createPPatternAssistant().isSimple(pattern)) { ANotUnaryExp notExp = new ANotUnaryExp(); AEqualsBinaryExp equalsExp = AstExpressionFactory.newAEqualsBinaryExp(patternToExp(pattern.clone(), assistantFactory, new UniqueNameGenerator(exp)), exp.clone()); notExp.setExp(equalsExp); return notExp; } else { ANotUnaryExp notExp = new ANotUnaryExp(); AExistsExp existsExp = new AExistsExp(); List<PMultipleBind> bindList = ContextHelper.bindListFromPattern(pattern.clone(), type.clone()); existsExp.setBindList(bindList); PExp matching = patternToExp(pattern,assistantFactory,new UniqueNameGenerator(exp)); AEqualsBinaryExp equalsExp = AstExpressionFactory.newAEqualsBinaryExp(matching, exp.clone()); existsExp.setPredicate(equalsExp); notExp.setExp(existsExp); return notExp; } }
public static ANotUnaryExp newANotUnaryExp(ILexLocation location, PExp readNotExpression) { ANotUnaryExp result = new ANotUnaryExp(); initExpressionUnary(result, location, readNotExpression); return result; }
/** * Called by the {@link ANotUnaryExp} node from {@link ANotUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ANotUnaryExp} node */ public void caseANotUnaryExp(ANotUnaryExp node) throws AnalysisException { _visitedNodes.add(node); inANotUnaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outANotUnaryExp(node); }
@Override public PExp getContextNode(PExp stitch) { ANotUnaryExp notExp = new ANotUnaryExp(); notExp.setExp(exp.clone()); notExp.setType(new ABooleanBasicType()); AImpliesBooleanBinaryExp impliesExp = AstExpressionFactory.newAImpliesBooleanBinaryExp(notExp, stitch); return impliesExp; }
/** * Creates a deep clone of this {@link ANotUnaryExp} 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 ANotUnaryExp} node */ public ANotUnaryExp clone(Map<INode,INode> oldToNewMap) { ANotUnaryExp node = new ANotUnaryExp( _type, _location, cloneNode(_exp, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ANotUnaryExp} node from {@link ANotUnaryExp#apply(IPOFAnalysis)}. * @param node the calling {@link ANotUnaryExp} node */ public void caseANotUnaryExp(ANotUnaryExp node) throws AnalysisException { _visitedNodes.add(node); inANotUnaryExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outANotUnaryExp(node); }
public TupleSelectObligation(PExp exp, PType type, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { // not is_(exp, type) super(exp, POType.TUPLE_SELECT, ctxt, exp.getLocation(), af); ANotUnaryExp notExp = new ANotUnaryExp(); notExp.setType(new ABooleanBasicType()); AIsExp isExp = new AIsExp(); isExp.setType(new ABooleanBasicType()); isExp.setTest(exp.clone()); isExp.setBasicType(type.clone()); // Do we need the type definition instead? If so, the visitor must provide it. notExp.setExp(isExp); stitch = notExp; valuetree.setPredicate(ctxt.getPredWithContext(stitch)); } }
/** * Called by the {@link ANotUnaryExp} node from {@link ANotUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ANotUnaryExp} node */ public A caseANotUnaryExp(ANotUnaryExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inANotUnaryExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this)); } mergeReturns(retVal,outANotUnaryExp(node)); return retVal; }
/** * Called by the {@link ANotUnaryExp} node from {@link ANotUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ANotUnaryExp} node */ public A caseANotUnaryExp(ANotUnaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inANotUnaryExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this, question)); } mergeReturns(retVal,outANotUnaryExp(node, question)); return retVal; }