5 public class SetExpr extends Expr {
9 public SetExpr(SetDescriptor sd) {
13 public String name() {
17 public boolean equals(Map remap, Expr e) {
18 if (e==null||!(e instanceof SetExpr))
20 SetExpr se=(SetExpr)e;
26 public boolean usesDescriptor(Descriptor s) {
34 public Set getInversedRelations() {
38 public Descriptor getDescriptor() {
42 public Set getRequiredDescriptors() {
43 HashSet v = new HashSet();
48 public void generate(CodeWriter writer, VarDescriptor dest) {
49 throw new IRException("unsupported");
52 public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
53 writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->contains(" + element.getSafeSymbol() + ");");
56 public void generate_size(CodeWriter writer, VarDescriptor dest) {
57 writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->count();");
60 public void prettyPrint(PrettyPrinter pp) {
61 pp.output(sd.getSafeSymbol());
64 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
65 this.td = sd.getType();