@Override public String defaultSSetType(SSetType type) throws AnalysisException { return type.getEmpty() ? "{}" : "set of (" + type.getSetof() + ")"; }
@Override public String defaultSSetType(SSetType node, PrettyPrinterEnv question) throws AnalysisException { return "" + "" + (node.getEmpty() ? "{}" : "set of (" + node.getSetof().apply(this, question) + ")"); }
@Override public Integer defaultSSetType(SSetType type) throws AnalysisException { return type.getEmpty() ? 0 : type.getSetof().apply(THIS); }
@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; }
@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; }
@Override public PType caseADistIntersectUnaryExp( ADistIntersectUnaryExp node, TypeCheckInfo question) throws AnalysisException { PExp exp = node.getExp(); question.qualifiers = null; PType arg = exp.apply(THIS, question.newConstraint(null)); if (question.assistantFactory.createPTypeAssistant().isSet(arg)) { SSetType set = question.assistantFactory.createPTypeAssistant().getSet(arg); if (set.getEmpty() || question.assistantFactory.createPTypeAssistant().isSet(set.getSetof())) { node.setType(set.getSetof()); return set.getSetof(); } } TypeCheckerErrors.report(3076, "Argument of 'dinter' is not a set of sets", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); }
@Override public PType caseADistMergeUnaryExp(ADistMergeUnaryExp 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 arg = exp.apply(THIS, expConstraint); if (question.assistantFactory.createPTypeAssistant().isSet(arg)) { SSetType set = question.assistantFactory.createPTypeAssistant().getSet(arg); if (!set.getEmpty() && question.assistantFactory.createPTypeAssistant().isMap(set.getSetof())) { node.setType(set.getSetof()); return set.getSetof(); } } TypeCheckerErrors.report(3077, "Merge argument is not a set of maps", node.getLocation(), node); return AstFactory.newAMapMapType(node.getLocation()); // Unknown types }
if (!st.getEmpty())