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