@Override public SExpIR caseASetEnumSetExp(ASetEnumSetExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); if (!(type instanceof SSetType)) { log.error("Unexpected set type for set enumeration expression: " + type.getClass().getName() + " at " + node.getLocation()); } LinkedList<PExp> members = node.getMembers(); AEnumSetExpIR enumSet = new AEnumSetExpIR(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); enumSet.setType(typeCg); LinkedList<SExpIR> membersCg = enumSet.getMembers(); for (PExp member : members) { SExpIR memberCg = member.apply(question.getExpVisitor(), question); if (memberCg != null) { membersCg.add(memberCg); } else { return null; } } return enumSet; }
@Override public PType caseASetEnumSetExp(ASetEnumSetExp node, TypeCheckInfo question) throws AnalysisException { PTypeSet ts = new PTypeSet(question.assistantFactory); node.setTypes(new LinkedList<PType>()); List<PType> types = node.getTypes(); TypeCheckInfo elemConstraint = question; if (question.constraint != null && question.assistantFactory.createPTypeAssistant().isSet(question.constraint)) { PType setType = question.assistantFactory.createPTypeAssistant().getSet(question.constraint).getSetof(); elemConstraint = question.newConstraint(setType); } for (PExp ex : node.getMembers()) { question.qualifiers = null; PType mt = ex.apply(THIS, elemConstraint); ts.add(mt); types.add(mt); } node.setType(ts.isEmpty() ? AstFactory.newASetSetType(node.getLocation()) : AstFactory.newASet1SetType(node.getLocation(), ts.getType(node.getLocation()))); return question.assistantFactory.createPTypeAssistant().possibleConstraint(question.constraint, node.getType(), node.getLocation()); }
@Override public Value caseASetEnumSetExp(ASetEnumSetExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); ValueSet values = new ValueSet(); for (PExp e : node.getMembers()) { values.add(e.apply(VdmRuntime.getExpressionEvaluator(), ctxt)); } return new SetValue(values); }