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 escjava.ast;
014
015 import java.util.Hashtable;
016 import java.util.Set;
017 import java.util.ArrayList;
018
019 import javafe.ast.*;
020 import javafe.util.Assert;
021 import javafe.util.Location;
022 import escjava.ParsedRoutineSpecs;
023
024 // Convention: unless otherwise noted, integer fields named "loc" refer
025 // to the location of the first character of the syntactic unit
026
027 //# TagBase javafe.tc.TagConstants.LAST_TAG + 1
028 //# VisitorRoot javafe.ast.Visitor
029
030
031 public class VarDeclModifierPragma extends ModifierPragma
032 {
033 public int tag;
034
035 public /*@ non_null @*/ LocalVarDecl decl;
036
037 public int loc;
038
039 public int locId;
040
041
042 public int getTag() { return tag; }
043
044 //@ public represents startLoc <- loc;
045 public /*@ pure @*/ int getStartLoc() { return loc; }
046
047
048 // Generated boilerplate constructors:
049
050 //@ ensures this.tag == tag;
051 //@ ensures this.decl == decl;
052 //@ ensures this.loc == loc;
053 //@ ensures this.locId == locId;
054 protected VarDeclModifierPragma(int tag, /*@ non_null @*/ LocalVarDecl decl, int loc, int locId) {
055 this.tag = tag;
056 this.decl = decl;
057 this.loc = loc;
058 this.locId = locId;
059 }
060
061 // Generated boilerplate methods:
062
063 public final int childCount() {
064 return 1;
065 }
066
067 public final Object childAt(int index) {
068 /*throws IndexOutOfBoundsException*/
069 if (index < 0)
070 throw new IndexOutOfBoundsException("AST child index " + index);
071 int indexPre = index;
072
073 int sz;
074
075 if (index == 0) return this.decl;
076 else index--;
077
078 throw new IndexOutOfBoundsException("AST child index " + indexPre);
079 } //@ nowarn Exception;
080
081 public final /*@non_null*/String toString() {
082 return "[VarDeclModifierPragma"
083 + " tag = " + this.tag
084 + " decl = " + this.decl
085 + " loc = " + this.loc
086 + " locId = " + this.locId
087 + "]";
088 }
089
090 public final void accept(javafe.ast.Visitor v) {
091 if (v instanceof Visitor) ((Visitor)v).visitVarDeclModifierPragma(this);
092 }
093
094 public final Object accept(javafe.ast.VisitorArgResult v, Object o) {
095 if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitVarDeclModifierPragma(this, o); else return null;
096 }
097
098 public void check() {
099 this.decl.check();
100 }
101
102 //@ ensures \result != null;
103 public static VarDeclModifierPragma make(int tag, /*@ non_null @*/ LocalVarDecl decl, int loc, int locId) {
104 VarDeclModifierPragma result = new VarDeclModifierPragma(tag, decl, loc, locId);
105 return result;
106 }
107 }