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 public class ClassDeclStmt extends Stmt
024 {
025 public /*@ non_null @*/ ClassDecl decl;
026
027
028 private void postCheck() {
029 // Awaiting information from Sun...
030 }
031
032 //@ public represents startLoc <- decl.getStartLoc();
033 public /*@ pure @*/ int getStartLoc() { return decl.getStartLoc(); }
034
035 //@ also public normal_behavior
036 //@ ensures \result == decl.getEndLoc();
037 public /*@ pure @*/ int getEndLoc() { return decl.getEndLoc(); }
038
039
040 // Generated boilerplate constructors:
041
042 //@ ensures this.decl == decl;
043 protected ClassDeclStmt(/*@ non_null @*/ ClassDecl decl) {
044 super();
045 this.decl = decl;
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.decl;
063 else index--;
064
065 throw new IndexOutOfBoundsException("AST child index " + indexPre);
066 } //@ nowarn Exception;
067
068 public final /*@non_null*/String toString() {
069 return "[ClassDeclStmt"
070 + " decl = " + this.decl
071 + "]";
072 }
073
074 public final int getTag() {
075 return TagConstants.CLASSDECLSTMT;
076 }
077
078 public final void accept(Visitor v) { v.visitClassDeclStmt(this); }
079
080 public final Object accept(VisitorArgResult v, Object o) {return v.visitClassDeclStmt(this, o); }
081
082 public void check() {
083 super.check();
084 this.decl.check();
085 postCheck();
086 }
087
088 //@ ensures \result != null;
089 public static ClassDeclStmt make(/*@ non_null @*/ ClassDecl decl) {
090 ClassDeclStmt result = new ClassDeclStmt(decl);
091 return result;
092 }
093 }