001    /* Copyright 2000, 2001, Compaq Computer Corporation */
002    
003    /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!  
004    
005       Most Java files in this directory which are part of the Javafe AST
006       are automatically generated using the astgen comment (see
007       ESCTools/Javafe/astgen) from the input file 'hierarchy.h'.  If you
008       wish to modify AST classes or introduce new ones, modify
009       'hierarchy.j.'
010     */
011    
012    package escjava.ast;
013    
014    import java.util.Hashtable;
015    import java.util.Set;
016    import java.util.ArrayList;
017    
018    import javafe.ast.*;
019    import javafe.util.Assert;
020    import javafe.util.Location;
021    import escjava.ParsedRoutineSpecs;
022    
023    // Convention: unless otherwise noted, integer fields named "loc" refer
024    // to the location of the first character of the syntactic unit
025    
026    //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
027    //# VisitorRoot javafe.ast.Visitor
028    
029    
030    public class SetCompExpr extends Expr
031    {
032      public /*@ non_null @*/ Type type;
033    
034      public /*@ non_null @*/ FormalParaDecl fp;
035    
036      public /*@ non_null @*/ Expr expr;
037    
038    
039      public int getStartLoc() { return fp.getStartLoc(); }
040    
041    
042    // Generated boilerplate constructors:
043    
044      /**
045       * Construct a raw SetCompExpr whose class invariant(s) have not
046       * yet been established.  It is the caller's job to
047       * initialize the returned node's fields so that any
048       * class invariants hold.
049       */
050      //@ requires I_will_establish_invariants_afterwards;
051      protected SetCompExpr() {}    //@ nowarn Invariant,NonNullInit;
052    
053    
054    // Generated boilerplate methods:
055    
056      public final int childCount() {
057         return 3;
058      }
059    
060      public final Object childAt(int index) {
061              /*throws IndexOutOfBoundsException*/
062         if (index < 0)
063            throw new IndexOutOfBoundsException("AST child index " + index);
064         int indexPre = index;
065    
066         int sz;
067    
068         if (index == 0) return this.type;
069         else index--;
070    
071         if (index == 0) return this.fp;
072         else index--;
073    
074         if (index == 0) return this.expr;
075         else index--;
076    
077         throw new IndexOutOfBoundsException("AST child index " + indexPre);
078      }   //@ nowarn Exception;
079    
080      public final String toString() {
081         return "[SetCompExpr"
082            + " type = " + this.type
083            + " fp = " + this.fp
084            + " expr = " + this.expr
085            + "]";
086      }
087    
088      public final int getTag() {
089         return TagConstants.SETCOMPEXPR;
090      }
091    
092      public final void accept(javafe.ast.Visitor v) { 
093        if (v instanceof Visitor) ((Visitor)v).visitSetCompExpr(this);
094      }
095    
096      public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
097        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitSetCompExpr(this, o); else return null;
098      }
099    
100      public void check() {
101         this.type.check();
102         this.fp.check();
103         this.expr.check();
104      }
105    
106      //@ ensures \result != null;
107      public static SetCompExpr make(/*@ non_null @*/ Type type, /*@ non_null @*/ FormalParaDecl fp, /*@ non_null @*/ Expr expr) {
108         //@ set I_will_establish_invariants_afterwards = true;
109         SetCompExpr result = new SetCompExpr();
110         result.type = type;
111         result.fp = fp;
112         result.expr = expr;
113         return result;
114      }
115    }