/** * Utility method for ACaseAlternative * * @param node * @param val * @param ctxt * @return * @throws AnalysisException */ public Value eval(ACaseAlternative node, Value val, Context ctxt) throws AnalysisException { Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "case alternative", ctxt); try { evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getPattern(), val, ctxt)); return node.getResult().apply(VdmRuntime.getExpressionEvaluator(), evalContext); } catch (PatternMatchException e) { // Silently fail (CasesExpression will try the others) } return null; }