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