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 ParsedSpecs extends ModifierPragma
032    {
033      public /*@ non_null @*/ RoutineDecl decl;
034    
035      public /*@ non_null @*/ ParsedRoutineSpecs specs;
036    
037    
038      public final int getTag() { return TagConstants.PARSEDSPECS; }
039    
040      //@ public represents startLoc <- decl.locId;
041      public /*@ pure @*/ int getStartLoc() { return decl.locId; }
042    
043    
044    // Generated boilerplate constructors:
045    
046      //@ ensures this.decl == decl;
047      //@ ensures this.specs == specs;
048      protected ParsedSpecs(/*@ non_null @*/ RoutineDecl decl, /*@ non_null @*/ ParsedRoutineSpecs specs) {
049         this.decl = decl;
050         this.specs = specs;
051      }
052    
053    // Generated boilerplate methods:
054    
055      public final int childCount() {
056         return 2;
057      }
058    
059      public final Object childAt(int index) {
060              /*throws IndexOutOfBoundsException*/
061         if (index < 0)
062            throw new IndexOutOfBoundsException("AST child index " + index);
063         int indexPre = index;
064    
065         int sz;
066    
067         if (index == 0) return this.decl;
068         else index--;
069    
070         if (index == 0) return this.specs;
071         else index--;
072    
073         throw new IndexOutOfBoundsException("AST child index " + indexPre);
074      }   //@ nowarn Exception;
075    
076      public final /*@non_null*/String toString() {
077         return "[ParsedSpecs"
078            + " decl = " + this.decl
079            + " specs = " + this.specs
080            + "]";
081      }
082    
083      public final void accept(javafe.ast.Visitor v) { 
084        if (v instanceof Visitor) ((Visitor)v).visitParsedSpecs(this);
085      }
086    
087      public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
088        if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitParsedSpecs(this, o); else return null;
089      }
090    
091      public void check() {
092         if (this.decl == null) throw new RuntimeException();
093         if (this.specs == null) throw new RuntimeException();
094      }
095    
096      //@ ensures \result != null;
097      public static ParsedSpecs make(/*@ non_null @*/ RoutineDecl decl, /*@ non_null @*/ ParsedRoutineSpecs specs) {
098         ParsedSpecs result = new ParsedSpecs(decl, specs);
099         return result;
100      }
101    }