@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);
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();
}