    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     * Represents a Name that occurs in an Expression position.
    024     * These are name-resolved to VariableAccess,
    025     * ExprFieldAccess or TypeFieldAccess.
    026     */
    027
    028    public class AmbiguousVariableAccess extends Expr
    029    {
    030      public /*@ non_null @*/ Name name;
    031
    032      public int getStartLoc() { return name.getStartLoc(); }
    033      public int getEndLoc() { return name.getEndLoc(); }
    034
    035
    036    // Generated boilerplate constructors:
    037
    038      /**
    039       * Construct a raw AmbiguousVariableAccess whose class invariant(s) have not
    040       * yet been established.  It is the caller's job to
    041       * initialize the returned node's fields so that any
    042       * class invariants hold.
    043       */
    044      //@ requires I_will_establish_invariants_afterwards;
    045      protected AmbiguousVariableAccess() {}    //@ nowarn Invariant,NonNullInit;
    046
    047
    048    // Generated boilerplate methods:
    049
    050      public final int childCount() {
    051         return 1;
    052      }
    053
    054      public final Object childAt(int index) {
    055              /*throws IndexOutOfBoundsException*/
    056         if (index < 0)
    057            throw new IndexOutOfBoundsException("AST child index " + index);
    058         int indexPre = index;
    059
    060         int sz;
    061
    062         if (index == 0) return this.name;
    063         else index--;
    064
    065         throw new IndexOutOfBoundsException("AST child index " + indexPre);
    066      }   //@ nowarn Exception;
    067
    068      public final String toString() {
    069         return "[AmbiguousVariableAccess"
    070            + " name = " + this.name
    071            + "]";
    072      }
    073
    074      public final int getTag() {
    075         return TagConstants.AMBIGUOUSVARIABLEACCESS;
    076      }
    077
    078      public final void accept(Visitor v) { v.visitAmbiguousVariableAccess(this); }
    079
    080      public final Object accept(VisitorArgResult v, Object o) {return v.visitAmbiguousVariableAccess(this, o); }
    081
    082      public void check() {
    083         super.check();
    084         this.name.check();
    085      }
    086
    087      //@ ensures \result != null;
    088      public static AmbiguousVariableAccess make(/*@ non_null @*/ Name name) {
    089         //@ set I_will_establish_invariants_afterwards = true;
    090         AmbiguousVariableAccess result = new AmbiguousVariableAccess();
    091         result.name = name;
    092         return result;
    093      }
    094    }