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 a Name that occurs in an Expression position.
025 * These are name-resolved to VariableAccess,
026 * ExprFieldAccess or TypeFieldAccess.
027 */
028
029 public class AmbiguousVariableAccess extends Expr
030 {
031 public /*@ non_null @*/ Name name;
032
033
034 //@ public represents startLoc <- name.getStartLoc();
035 public /*@ pure @*/ int getStartLoc() { return name.getStartLoc(); }
036 //@ also public normal_behavior
037 //@ ensures \result == name.getEndLoc();
038 public /*@ pure @*/ int getEndLoc() { return name.getEndLoc(); }
039
040
041 // Generated boilerplate constructors:
042
043 //@ ensures this.name == name;
044 protected AmbiguousVariableAccess(/*@ non_null @*/ Name name) {
045 super();
046 this.name = name;
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.name;
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 "[AmbiguousVariableAccess"
071 + " name = " + this.name
072 + "]";
073 }
074
075 public final int getTag() {
076 return TagConstants.AMBIGUOUSVARIABLEACCESS;
077 }
078
079 public final void accept(Visitor v) { v.visitAmbiguousVariableAccess(this); }
080
081 public final Object accept(VisitorArgResult v, Object o) {return v.visitAmbiguousVariableAccess(this, o); }
082
083 public void check() {
084 super.check();
085 this.name.check();
086 }
087
088 //@ ensures \result != null;
089 public static AmbiguousVariableAccess make(/*@ non_null @*/ Name name) {
090 AmbiguousVariableAccess result = new AmbiguousVariableAccess(name);
091 return result;
092 }
093 }