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 javafe.ast;
014    
015    import javafe.util.Assert;
016    import javafe.util.Location;
017    import javafe.util.ErrorSet;
018    
019    // Convention: unless otherwise noted, integer fields named "loc" refer
020    // to the location of the first character of the syntactic unit
021    
022    
023    
024    /** 
025     * Used to indicate the type of an illegal operation, so that error messages
026     * do not unnecessarily propagate; should only be used if the error has
027     * already been reported.
028     */
029    public class ErrorType extends Type
030    {
031      //@ invariant_redundantly isInternal;
032    
033      //@ public represents startLoc <- Location.NULL;
034      public /*@ pure @*/ int getStartLoc() { return Location.NULL; }
035    
036      protected ErrorType() {}
037    
038      public static /*@ non_null */ ErrorType make() {
039        ErrorType result = new ErrorType();
040        return result;
041      }
042    
043    
044    // Generated boilerplate constructors:
045    
046       //@ ensures this.tmodifiers == tmodifiers;
047       protected ErrorType(TypeModifierPragmaVec tmodifiers) {
048          super(tmodifiers);
049       }
050    
051    // Generated boilerplate methods:
052    
053       public final int childCount() {
054          int sz = 0;
055          if (this.tmodifiers != null) sz += this.tmodifiers.size();
056          return sz + 0;
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          sz = (this.tmodifiers == null ? 0 : this.tmodifiers.size());
068          if (0 <= index && index < sz)
069             return this.tmodifiers.elementAt(index);
070          else index -= sz;
071    
072          throw new IndexOutOfBoundsException("AST child index " + indexPre);
073       }   //@ nowarn Exception;
074    
075       public final /*@non_null*/String toString() {
076          return "[ErrorType"
077             + " tmodifiers = " + this.tmodifiers
078             + "]";
079       }
080    
081       public final int getTag() {
082          return TagConstants.ERRORTYPE;
083       }
084    
085       public final void accept(Visitor v) { v.visitErrorType(this); }
086    
087       public final Object accept(VisitorArgResult v, Object o) {return v.visitErrorType(this, o); }
088    
089       public void check() {
090          super.check();
091          if (this.tmodifiers != null)
092             for(int i = 0; i < this.tmodifiers.size(); i++)
093                this.tmodifiers.elementAt(i).check();
094       }
095    
096       //@ ensures \result != null;
097       public static ErrorType make(TypeModifierPragmaVec tmodifiers) {
098          ErrorType result = new ErrorType(tmodifiers);
099          return result;
100       }
101    }