@Override public PTypeSet caseACaseAlternativeStm(ACaseAlternativeStm statement) throws AnalysisException { return statement.getResult().apply(THIS); }
@Override public PExp caseACasesStm(ACasesStm stm, Integer lineno) throws AnalysisException { PExp found = null; for (ACaseAlternativeStm stmt : stm.getCases()) { found = stmt.getResult().apply(THIS, lineno); if (found != null) { break; } } return found; }
@Override public IProofObligationList caseACaseAlternativeStm( ACaseAlternativeStm node, IPOContextStack question) throws AnalysisException { try { IProofObligationList obligations = new ProofObligationList(); obligations.addAll(node.getResult().apply(mainVisitor, question)); return obligations; } catch (Exception e) { throw new POException(node, e.getMessage()); } }
@Override public void caseACaseAlternativeStm(ACaseAlternativeStm node) throws AnalysisException { if (!proceed(node)) { return; } handleCase(node.getDefs(), node.getPattern(), node.getResult()); }
@Override public PStm caseACasesStm(ACasesStm stm, Integer lineno) throws AnalysisException { PStm found = findStatementBaseCase(stm, lineno); if (found != null) { return found; } for (ACaseAlternativeStm stmt : stm.getCases()) { found = stmt.getResult().apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stmt.getResult(), // lineno); if (found != null) { break; } } return found; }
@Override public SStmIR caseACaseAlternativeStm(ACaseAlternativeStm node, IRInfo question) throws AnalysisException { PPattern pattern = node.getPattern(); PStm result = node.getResult(); SPatternIR patternCg = pattern.apply(question.getPatternVisitor(), question); SStmIR resultCg = result.apply(question.getStmVisitor(), question); ACaseAltStmStmIR caseCg = new ACaseAltStmStmIR(); caseCg.setPattern(patternCg); caseCg.setResult(resultCg); return caseCg; }
private Value eval(ACaseAlternativeStm node, Value val, Context ctxt) throws AnalysisException { Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "case alternative", ctxt); node.getPattern().getLocation().hit(); node.getLocation().hit(); try { evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getPattern(), val, ctxt)); return node.getResult().apply(VdmRuntime.getStatementEvaluator(), evalContext); } catch (PatternMatchException e) { // CasesStatement tries the others } return null; }
PType r = node.getResult().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, null, question.returnType)); local.unusedCheck();