@Override public PExp caseATrapStm(ATrapStm stm, Integer lineno) throws AnalysisException { PExp found = stm.getBody().apply(THIS, lineno);// PStmAssistantInterpreter.findExpression(stm.getBody(), // lineno); if (found != null) { return found; } return stm.getWith().apply(THIS, lineno);// PStmAssistantInterpreter.findExpression(stm.getWith(), lineno); }
/** * Called by the {@link ATrapStm} node from {@link ATrapStm#apply(IAnalysis)}. * @param node the calling {@link ATrapStm} node */ public void caseATrapStm(ATrapStm node) throws AnalysisException { _visitedNodes.add(node); inATrapStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getPatternBind() != null && !_visitedNodes.contains(node.getPatternBind())) { node.getPatternBind().apply(this); } if(node.getWith() != null && !_visitedNodes.contains(node.getWith())) { node.getWith().apply(this); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this); } outATrapStm(node); }
/** * Called by the {@link ATrapStm} node from {@link ATrapStm#apply(IAnalysis)}. * @param node the calling {@link ATrapStm} node */ public void caseATrapStm(ATrapStm node, Q question) throws AnalysisException { _visitedNodes.add(node); inATrapStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getPatternBind() != null && !_visitedNodes.contains(node.getPatternBind())) { node.getPatternBind().apply(this, question); } if(node.getWith() != null && !_visitedNodes.contains(node.getWith())) { node.getWith().apply(this, question); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this, question); } outATrapStm(node, question); }
@Override public PStm caseATrapStm(ATrapStm stm, Integer lineno) throws AnalysisException { PStm found = findStatementBaseCase(stm, lineno); if (found != null) { return found; } found = stm.getBody().apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stm.getBody(), lineno); if (found != null) { return found; } return stm.getWith().apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stm.getWith(), lineno); }
/** * Called by the {@link ATrapStm} node from {@link ATrapStm#apply(IPOFAnalysis)}. * @param node the calling {@link ATrapStm} node */ public void caseATrapStm(ATrapStm node) throws AnalysisException { _visitedNodes.add(node); inATrapStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getPatternBind() != null && !_visitedNodes.contains(node.getPatternBind())) { node.getPatternBind().apply(this); } if(node.getWith() != null && !_visitedNodes.contains(node.getWith())) { node.getWith().apply(this); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this); } outATrapStm(node); }
@Override public void caseATrapStm(ATrapStm node) throws AnalysisException { if (!proceed(node)) { return; } if (node.getBody() != null) { node.getBody().apply(this); } openScope(node.getPatternBind().getPattern(), node.getPatternBind().getDefs(), node.getWith()); if (node.getWith() != null) { node.getWith().apply(this); } for (PDefinition def : node.getPatternBind().getDefs()) { removeLocalDefFromScope(def); } }
@Override public PTypeSet caseATrapStm(ATrapStm statement) throws AnalysisException { PTypeSet types = new PTypeSet(af); types.addAll(statement.getBody().apply(THIS)); types.addAll(statement.getWith().apply(THIS)); return types; }
/** * Called by the {@link ATrapStm} node from {@link ATrapStm#apply(IAnalysis)}. * @param node the calling {@link ATrapStm} node */ public A caseATrapStm(ATrapStm node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inATrapStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getPatternBind() != null && !_visitedNodes.contains(node.getPatternBind())) { mergeReturns(retVal,node.getPatternBind().apply(this, question)); } if(node.getWith() != null && !_visitedNodes.contains(node.getWith())) { mergeReturns(retVal,node.getWith().apply(this, question)); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { mergeReturns(retVal,node.getBody().apply(this, question)); } mergeReturns(retVal,outATrapStm(node, question)); return retVal; }
/** * Called by the {@link ATrapStm} node from {@link ATrapStm#apply(IAnalysis)}. * @param node the calling {@link ATrapStm} node */ public A caseATrapStm(ATrapStm node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inATrapStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getPatternBind() != null && !_visitedNodes.contains(node.getPatternBind())) { mergeReturns(retVal,node.getPatternBind().apply(this)); } if(node.getWith() != null && !_visitedNodes.contains(node.getWith())) { mergeReturns(retVal,node.getWith().apply(this)); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { mergeReturns(retVal,node.getBody().apply(this)); } mergeReturns(retVal,outATrapStm(node)); return retVal; }
rv = node.getWith().apply(VdmRuntime.getStatementEvaluator(), evalContext); rv = node.getWith().apply(VdmRuntime.getStatementEvaluator(), evalContext); rv = node.getWith().apply(VdmRuntime.getStatementEvaluator(), evalContext); 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);
list.addAll(node.getWith().apply(rootVisitor, question)); list.addAll(node.getBody().apply(rootVisitor, question)); return list;
@Override public PType caseATrapStm(ATrapStm node, TypeCheckInfo question) throws AnalysisException { PTypeSet rtypes = new PTypeSet(question.assistantFactory); PStm body = node.getBody(); PType bt = body.apply(THIS, question); rtypes.add(bt); PTypeSet extype = exitCheck(body, question); PType ptype = null; if (extype.isEmpty()) { TypeCheckerErrors.report(3241, "Body of trap statement does not throw exceptions", node.getLocation(), node); ptype = AstFactory.newAUnknownType(body.getLocation()); } else { ptype = extype.getType(body.getLocation()); } node.setType(ptype); node.getPatternBind().apply(THIS, question); // TODO: PatternBind stuff List<PDefinition> defs = getDefinitions(node.getPatternBind()); question.assistantFactory.createPDefinitionListAssistant().typeCheck(defs, THIS, question); Environment local = new FlatCheckedEnvironment(question.assistantFactory, defs, question.env, question.scope); rtypes.add(node.getWith().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers))); node.setType(rtypes.getType(node.getLocation())); return node.getType(); }