/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this); } outAMkBasicExp(node); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this, question); } outAMkBasicExp(node, question); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IPOFAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this); } outAMkBasicExp(node); }
@Override public PType caseAMkBasicExp(AMkBasicExp node, TypeCheckInfo question) throws AnalysisException { PType argtype = node.getArg().apply(THIS, question.newConstraint(null)); if (!(node.getType() instanceof ATokenBasicType) && !question.assistantFactory.createPTypeAssistant().equals(argtype, node.getType())) { TypeCheckerErrors.report(3125, "Argument of mk_" + node.getType() + " is the wrong type", node.getLocation(), node); } return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public A caseAMkBasicExp(AMkBasicExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMkBasicExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { mergeReturns(retVal,node.getArg().apply(this, question)); } mergeReturns(retVal,outAMkBasicExp(node, question)); return retVal; }
@Override public LexNameSet caseAMkBasicExp(AMkBasicExp node, FreeVarInfo info) throws AnalysisException { LexNameSet names = node.getType().apply(this, info); names.addAll(node.getArg().apply(this, info)); return names; }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public A caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMkBasicExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { mergeReturns(retVal,node.getArg().apply(this)); } mergeReturns(retVal,outAMkBasicExp(node)); return retVal; }
@Override public Value caseAMkBasicExp(AMkBasicExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); Value v = node.getArg().apply(VdmRuntime.getExpressionEvaluator(), ctxt); if (node.getType() instanceof ATokenBasicType) { return new TokenValue(v); } else { try { v = v.convertTo(node.getType(), ctxt); } catch (ValueException e) { VdmRuntimeError.abort(node.getLocation(), 4022, "mk_ type argument is not " + node.getType(), ctxt); } } return v; }
@Override public SExpIR caseAMkBasicExp(AMkBasicExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); if (!(type instanceof ATokenBasicType)) { question.addUnsupportedNode(node, "Expected token type for mk basic expression. Got: " + type); return null; } PExp arg = node.getArg(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR argCg = arg.apply(question.getExpVisitor(), question); AMkBasicExpIR mkBasicExp = new AMkBasicExpIR(); mkBasicExp.setType(typeCg); mkBasicExp.setArg(argCg); return mkBasicExp; }