    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 javafe.ast;
    013
    014    import javafe.util.Assert;
    015    import javafe.util.Location;
    016    import javafe.util.ErrorSet;
    017
    018    // Convention: unless otherwise noted, integer fields named "loc" refer
    019    // to the location of the first character of the syntactic unit
    020
    021
    022
    023    /**
    024     * Used to indicate the type of an illegal operation, so that error messages
    025     * do not unnecessarily propagate; should only be used if the error has
    026     * already been reported.
    027     */
    028    public class ErrorType extends Type
    029    {
    030      public int getStartLoc() { return Location.NULL; }
    031
    032      //@ ensures \result != null;
    033      //@ ensures !\result.syntax;
    034      public static ErrorType make() {
    035          //@ set I_will_establish_invariants_afterwards = true;
    036          //@ set result.syntax = false;
    037          return new ErrorType();
    038      }
    039
    040
    041    // Generated boilerplate constructors:
    042
    043       /**
    044        * Construct a raw ErrorType whose class invariant(s) have not
    045        * yet been established.  It is the caller's job to
    046        * initialize the returned node's fields so that any
    047        * class invariants hold.
    048        */
    049       //@ requires I_will_establish_invariants_afterwards;
    050       protected ErrorType() {}    //@ nowarn Invariant,NonNullInit;
    051
    052
    053    // Generated boilerplate methods:
    054
    055       public final int childCount() {
    056          int sz = 0;
    057          if (this.tmodifiers != null) sz += this.tmodifiers.size();
    058          return sz + 0;
    059       }
    060
    061       public final Object childAt(int index) {
    062               /*throws IndexOutOfBoundsException*/
    063          if (index < 0)
    064             throw new IndexOutOfBoundsException("AST child index " + index);
    065          int indexPre = index;
    066
    067          int sz;
    068
    069          sz = (this.tmodifiers == null ? 0 : this.tmodifiers.size());
    070          if (0 <= index && index < sz)
    071             return this.tmodifiers.elementAt(index);
    072          else index -= sz;
    073
    074          throw new IndexOutOfBoundsException("AST child index " + indexPre);
    075       }   //@ nowarn Exception;
    076
    077       public final String toString() {
    078          return "[ErrorType"
    079             + " tmodifiers = " + this.tmodifiers
    080             + "]";
    081       }
    082
    083       public final int getTag() {
    084          return TagConstants.ERRORTYPE;
    085       }
    086
    087       public final void accept(Visitor v) { v.visitErrorType(this); }
    088
    089       public final Object accept(VisitorArgResult v, Object o) {return v.visitErrorType(this, o); }
    090
    091       public void check() {
    092          super.check();
    093          if (this.tmodifiers != null)
    094             for(int i = 0; i < this.tmodifiers.size(); i++)
    095                this.tmodifiers.elementAt(i).check();
    096       }
    097
    098       //@ ensures \result != null;
    099       public static ErrorType make(TypeModifierPragmaVec tmodifiers) {
    100          //@ set I_will_establish_invariants_afterwards = true;
    101          ErrorType result = new ErrorType();
    102          result.tmodifiers = tmodifiers;
    103          return result;
    104       }
    105    }