@Override public Boolean defaultSSetType(SSetType type, AAccessSpecifierAccessSpecifier accessSpecifier) throws AnalysisException { return type.getSetof().apply(this, accessSpecifier); }
@Override public PType defaultSSetType(SSetType type, Newquestion question) throws AnalysisException { if (type.getResolved()) { return type; } else { type.setResolved(true); } try { type.setSetof(af.createPTypeAssistant().typeResolve(type.getSetof(), question.root, question.rootVisitor, question.question)); if (question.root != null) { question.root.setInfinite(false); // Could be empty } return type; } catch (TypeCheckException e) { type.apply(af.getTypeUnresolver()); throw e; } }
@Override public void defaultSSetType(SSetType type) throws AnalysisException { if (!type.getResolved()) { return; } else { type.setResolved(false); } type.getSetof().apply(THIS); }
node.getSetType().apply(this, question);
somType.setSetof(mapEnumExp.getType().clone()); setOfMaplets.setType(somType); domM1.setExp(getVarExp(m1, mapEnumExp.getType())); SSetType domType = new ASetSetType(); domType.setSetof(af.createPTypeAssistant().getMap(mapEnumExp.getType().clone())); domM1.setType(domType.clone()); AMapDomainUnaryExp domM2 = new AMapDomainUnaryExp(); domM2.setExp(getVarExp(m2, mapEnumExp.getType())); domM2.setType(domType.clone());
node.getSetType().apply(this);
@Override public PTypeList defaultSSetType(SSetType node) throws AnalysisException { return node.getSetof().apply(THIS); }
node.getSetType().apply(this);
@Override public ValueList defaultSSetType(SSetType type, Context ctxt) throws AnalysisException { ValueList list = type.getSetof().apply(THIS, ctxt); ValueSet set = new ValueSet(list.size()); set.addAll(list); List<ValueSet> psets = set.powerSet(); list.clear(); for (ValueSet v : psets) { list.add(new SetValue(v)); } return list; }
node.getSetType().apply(this);
@Override public PType caseADistUnionUnaryExp(ADistUnionUnaryExp node, TypeCheckInfo question) throws AnalysisException { PExp exp = node.getExp(); question.qualifiers = null; TypeCheckInfo expConstraint = question; if (question.constraint != null) { PType stype = AstFactory.newASetSetType(node.getLocation(), question.constraint); expConstraint = question.newConstraint(stype); } PType type = exp.apply(THIS, expConstraint); if (question.assistantFactory.createPTypeAssistant().isSet(type)) { SSetType set = question.assistantFactory.createPTypeAssistant().getSet(type); if (question.assistantFactory.createPTypeAssistant().isSet(set.getSetof())) { node.setType(set.getSetof()); return set.getSetof(); } } TypeCheckerErrors.report(3078, "dunion argument is not a set of sets", node.getLocation(), node); node.setType(AstFactory.newASetSetType(node.getLocation(), AstFactory.newAUnknownType(node.getLocation()))); return node.getType(); }
@Override public STypeIR defaultSSetType(SSetType node, IRInfo question) throws AnalysisException { PType setOf = node.getSetof(); STypeIR typeCg = setOf.apply(question.getTypeVisitor(), question); boolean empty = node.getEmpty(); ASetSetTypeIR setType = new ASetSetTypeIR(); setType.setSetOf(typeCg); setType.setEmpty(empty); return setType; }
node.getSetType().apply(this);
@Override protected Value convertValueTo(PType to, Context ctxt, Set<PType> done) throws AnalysisException { if (to instanceof SSetType) { if (to instanceof ASet1SetType && values.isEmpty()) { abort(4170, "Cannot convert empty set to set1", ctxt); } SSetType setto = (SSetType) to; ValueSet ns = new ValueSet(); for (Value v : values) { ns.add(v.convertValueTo(setto.getSetof(), ctxt)); } return new SetValue(ns); } else { return super.convertValueTo(to, ctxt, done); } }
@Override public List<PDefinition> caseASetPattern(ASetPattern pattern, NewQuestion question) throws AnalysisException { // return ASetPatternAssistantTC.getAllDefinitions(pattern, question.ptype, question.scope); List<PDefinition> defs = new Vector<PDefinition>(); if (!af.createPTypeAssistant().isSet(question.ptype)) { TypeCheckerErrors.report(3204, "Set pattern is not matched against set type", pattern.getLocation(), pattern); TypeCheckerErrors.detail("Actual type", question.ptype); } else { SSetType set = af.createPTypeAssistant().getSet(question.ptype); if (!set.getEmpty()) { for (PPattern p : pattern.getPlist()) { defs.addAll(af.createPPatternAssistant().getDefinitions(p, set.getSetof(), question.scope)); } } } return defs; }
node.getSetType().apply(this, question);
@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()); }