@Override public List<PMultipleBind> caseATypeBind(ATypeBind bind) throws AnalysisException { List<PPattern> plist = new Vector<PPattern>(); plist.add(bind.getPattern().clone()); List<PMultipleBind> mblist = new Vector<PMultipleBind>(); mblist.add(AstFactory.newATypeMultipleBind(plist, bind.getType().clone())); return mblist; }
public POForAllContext(ALambdaExp exp) { this.bindings = new Vector<PMultipleBind>(); for (ATypeBind tb : exp.getBindList()) { List<PPattern> pl = new ArrayList<PPattern>(); pl.add(tb.getPattern().clone()); ATypeMultipleBind mtb = AstFactory.newATypeMultipleBind(pl, tb.getType().clone()); bindings.add(mtb); } }
/** * Called by the {@link ATypeBind} node from {@link ATypeBind#apply(IPOFAnalysis)}. * @param node the calling {@link ATypeBind} node */ public void caseATypeBind(ATypeBind node) throws AnalysisException { _visitedNodes.add(node); inATypeBind(node); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outATypeBind(node); }
/** * Called by the {@link ATypeBind} node from {@link ATypeBind#apply(IAnalysis)}. * @param node the calling {@link ATypeBind} node */ public void caseATypeBind(ATypeBind node) throws AnalysisException { _visitedNodes.add(node); inATypeBind(node); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outATypeBind(node); }
/** * Called by the {@link ATypeBind} node from {@link ATypeBind#apply(IAnalysis)}. * @param node the calling {@link ATypeBind} node */ public void caseATypeBind(ATypeBind node, Q question) throws AnalysisException { _visitedNodes.add(node); inATypeBind(node, question); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { node.getPattern().apply(this, question); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } outATypeBind(node, question); }
/** * Called by the {@link ATypeBind} node from {@link ATypeBind#apply(IAnalysis)}. * @param node the calling {@link ATypeBind} node */ public A caseATypeBind(ATypeBind node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inATypeBind(node)); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { mergeReturns(retVal,node.getPattern().apply(this)); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } mergeReturns(retVal,outATypeBind(node)); return retVal; }
/** * Called by the {@link ATypeBind} node from {@link ATypeBind#apply(IAnalysis)}. * @param node the calling {@link ATypeBind} node */ public A caseATypeBind(ATypeBind node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inATypeBind(node, question)); if(node.getPattern() != null && !_visitedNodes.contains(node.getPattern())) { mergeReturns(retVal,node.getPattern().apply(this, question)); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } mergeReturns(retVal,outATypeBind(node, question)); return retVal; }
@Override public SBindIR caseATypeBind(ATypeBind node, IRInfo question) throws AnalysisException { PPattern pattern = node.getPattern(); SPatternIR patternCg = pattern.apply(question.getPatternVisitor(), question); PType boundType = node.getType(); STypeIR boundTypeCg = boundType.apply(question.getTypeVisitor(), question); ATypeBindIR setBind = new ATypeBindIR(); setBind.setPattern(patternCg); setBind.setType(boundTypeCg); return setBind; }
paramDefinitions.addAll(question.assistantFactory.createPPatternAssistant().getDefinitions(tb.getPattern(), tb.getType(), NameScope.LOCAL)); paramPatterns.add(tb.getPattern()); tb.setType(question.assistantFactory.createPTypeAssistant().typeResolve(tb.getType(), null, THIS, question)); ptypes.add(tb.getType());
@Override public SExpIR caseALambdaExp(ALambdaExp node, IRInfo question) throws AnalysisException { LinkedList<ATypeBind> bindList = node.getBindList(); PExp exp = node.getExpression(); PType type = node.getType(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR expCg = exp.apply(question.getExpVisitor(), question); ALambdaExpIR lambdaExp = new ALambdaExpIR(); lambdaExp.setType(typeCg); lambdaExp.setExp(expCg); LinkedList<AFormalParamLocalParamIR> params = lambdaExp.getParams(); for (ATypeBind typeBind : bindList) { PType bindType = typeBind.getType(); PPattern pattern = typeBind.getPattern(); STypeIR bindTypeCg = bindType.apply(question.getTypeVisitor(), question); SPatternIR patternCg = pattern.apply(question.getPatternVisitor(), question); AFormalParamLocalParamIR param = new AFormalParamLocalParamIR(); param.setPattern(patternCg); param.setType(bindTypeCg); params.add(param); } return lambdaExp; }
evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(typebind.getPattern(), converted, ctxt));
evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(typebind.getPattern(), converted, ctxt)); Value rv = node.getStatement().apply(VdmRuntime.getStatementEvaluator(), evalContext);
nvpl = af.createPPatternAssistant().getNamedValues(def.getTypebind().getPattern(), converted, initialContext); } catch (PatternMatchException e)
Value converted = exval.convertTo(typebind.getType(), ctxt); Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "trap type", ctxt); evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(typebind.getPattern(), converted, ctxt)); rv = node.getWith().apply(VdmRuntime.getStatementEvaluator(), evalContext);
node.setDefs(question.assistantFactory.createPPatternAssistant().getDefinitions(typebind.getPattern(), node.getDefType(), question.scope));