@Override public IProofObligationList caseALenUnaryExp(ALenUnaryExp node, IPOContextStack question) throws AnalysisException { return node.getExp().apply(mainVisitor, question); }
/** * Called by the {@link ALenUnaryExp} node from {@link ALenUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ALenUnaryExp} node */ public void caseALenUnaryExp(ALenUnaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inALenUnaryExp(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); } outALenUnaryExp(node, question); }
/** * Called by the {@link ALenUnaryExp} node from {@link ALenUnaryExp#apply(IPOFAnalysis)}. * @param node the calling {@link ALenUnaryExp} node */ public void caseALenUnaryExp(ALenUnaryExp node) throws AnalysisException { _visitedNodes.add(node); inALenUnaryExp(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); } outALenUnaryExp(node); }
/** * Called by the {@link ALenUnaryExp} node from {@link ALenUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ALenUnaryExp} node */ public void caseALenUnaryExp(ALenUnaryExp node) throws AnalysisException { _visitedNodes.add(node); inALenUnaryExp(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); } outALenUnaryExp(node); }
/** * Called by the {@link ALenUnaryExp} node from {@link ALenUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ALenUnaryExp} node */ public A caseALenUnaryExp(ALenUnaryExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inALenUnaryExp(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,outALenUnaryExp(node, question)); return retVal; }
/** * Called by the {@link ALenUnaryExp} node from {@link ALenUnaryExp#apply(IAnalysis)}. * @param node the calling {@link ALenUnaryExp} node */ public A caseALenUnaryExp(ALenUnaryExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inALenUnaryExp(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,outALenUnaryExp(node)); return retVal; }
@Override public Value caseALenUnaryExp(ALenUnaryExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); try { return new NaturalValue(node.getExp().apply(VdmRuntime.getExpressionEvaluator(), ctxt).seqValue(ctxt).size()); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } catch (ContextException e) { throw e; // To avoid case below } catch (Exception e) { return VdmRuntimeError.abort(node.getLocation(), 4065, e.getMessage(), ctxt); } }
@Override public PType caseALenUnaryExp(ALenUnaryExp node, TypeCheckInfo question) throws AnalysisException { PExp exp = node.getExp(); question.qualifiers = null; PType etype = exp.apply(THIS, question.newConstraint(null)); if (!question.assistantFactory.createPTypeAssistant().isSeq(etype)) { TypeCheckerErrors.report(3116, "Argument to 'len' is not a sequence", node.getLocation(), node); } node.setType(AstFactory.newANatNumericBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().possibleConstraint(question.constraint, node.getType(), node.getLocation()); }