    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 IdExprDeclPragma extends TypeDeclElemPragma
    031    {
    032      public int tag;
    033
    034      public /*@ non_null @*/ Identifier id;
    035
    036      public /*@ non_null @*/ Expr expr;
    037
    038      public int modifiers;
    039
    040      public int loc;
    041
    042      public int locId;
    043
    044
    045      public final int getTag() { return tag; }
    046      public int getModifiers() { return modifiers; }
    047
    048      public int getStartLoc() { return loc; }
    049      public int getEndLoc() { return expr.getEndLoc(); }
    050
    051
    052    // Generated boilerplate constructors:
    053
    054      /**
    055       * Construct a raw IdExprDeclPragma whose class invariant(s) have not
    056       * yet been established.  It is the caller's job to
    057       * initialize the returned node's fields so that any
    058       * class invariants hold.
    059       */
    060      //@ requires I_will_establish_invariants_afterwards;
    061      protected IdExprDeclPragma() {}    //@ nowarn Invariant,NonNullInit;
    062
    063
    064    // Generated boilerplate methods:
    065
    066      public final int childCount() {
    067         return 2;
    068      }
    069
    070      public final Object childAt(int index) {
    071              /*throws IndexOutOfBoundsException*/
    072         if (index < 0)
    073            throw new IndexOutOfBoundsException("AST child index " + index);
    074         int indexPre = index;
    075
    076         int sz;
    077
    078         if (index == 0) return this.id;
    079         else index--;
    080
    081         if (index == 0) return this.expr;
    082         else index--;
    083
    084         throw new IndexOutOfBoundsException("AST child index " + indexPre);
    085      }   //@ nowarn Exception;
    086
    087      public final String toString() {
    088         return "[IdExprDeclPragma"
    089            + " tag = " + this.tag
    090            + " id = " + this.id
    091            + " expr = " + this.expr
    092            + " modifiers = " + this.modifiers
    093            + " loc = " + this.loc
    094            + " locId = " + this.locId
    095            + "]";
    096      }
    097
    098      public final void accept(javafe.ast.Visitor v) {
    099        if (v instanceof Visitor) ((Visitor)v).visitIdExprDeclPragma(this);
    100      }
    101
    102      public final Object accept(javafe.ast.VisitorArgResult v, Object o) {
    103        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitIdExprDeclPragma(this, o); else return null;
    104      }
    105
    106      public void check() {
    107         if (this.id == null) throw new RuntimeException();
    108         this.expr.check();
    109      }
    110
    111      //@ ensures \result != null;
    112      public static IdExprDeclPragma make(int tag, /*@ non_null @*/ Identifier id, /*@ non_null @*/ Expr expr, int modifiers, int loc, int locId) {
    113         //@ set I_will_establish_invariants_afterwards = true;
    114         IdExprDeclPragma result = new IdExprDeclPragma();
    115         result.tag = tag;
    116         result.id = id;
    117         result.expr = expr;
    118         result.modifiers = modifiers;
    119         result.loc = loc;
    120         result.locId = locId;
    121         return result;
    122      }
    123    }