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     * Represents an ObjectDesignator of the form "Expr . ".
025     *
026     * Is created both by the parser (eg for "(x).y"),
027     * and by the name resolution code (eg for "x.y").
028     */
029    
030    public class ExprObjectDesignator extends ObjectDesignator
031    {
032      public /*@ non_null @*/ Expr expr;
033    
034      //@ public represents startLoc <- expr.getStartLoc();
035      public /*@ pure @*/ int getStartLoc() { return expr.getStartLoc(); }
036      public Type type;
037      public Type type() { return type; }
038    
039    
040    // Generated boilerplate constructors:
041    
042      //@ ensures this.locDot == locDot;
043      //@ ensures this.expr == expr;
044      protected ExprObjectDesignator(int locDot, /*@ non_null @*/ Expr expr) {
045         super(locDot);
046         this.expr = expr;
047      }
048    
049    // Generated boilerplate methods:
050    
051      public final int childCount() {
052         return 1;
053      }
054    
055      public final Object childAt(int index) {
056              /*throws IndexOutOfBoundsException*/
057         if (index < 0)
058            throw new IndexOutOfBoundsException("AST child index " + index);
059         int indexPre = index;
060    
061         int sz;
062    
063         if (index == 0) return this.expr;
064         else index--;
065    
066         throw new IndexOutOfBoundsException("AST child index " + indexPre);
067      }   //@ nowarn Exception;
068    
069      public final /*@non_null*/String toString() {
070         return "[ExprObjectDesignator"
071            + " locDot = " + this.locDot
072            + " expr = " + this.expr
073            + "]";
074      }
075    
076      public final int getTag() {
077         return TagConstants.EXPROBJECTDESIGNATOR;
078      }
079    
080      public final void accept(Visitor v) { v.visitExprObjectDesignator(this); }
081    
082      public final Object accept(VisitorArgResult v, Object o) {return v.visitExprObjectDesignator(this, o); }
083    
084      public void check() {
085         super.check();
086         this.expr.check();
087      }
088    
089      //@ requires locDot != javafe.util.Location.NULL;
090      //@ ensures \result != null;
091      public static ExprObjectDesignator make(int locDot, /*@ non_null @*/ Expr expr) {
092         ExprObjectDesignator result = new ExprObjectDesignator(locDot, expr);
093         return result;
094      }
095    }