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 VarDeclStmt extends Stmt
024    {
025      public /*@ non_null @*/ LocalVarDecl decl;
026    
027    
028      //@ public represents startLoc <- decl.getStartLoc();
029      public /*@ pure @*/ int getStartLoc() { return decl.getStartLoc(); }
030    
031      //@ also public normal_behavior
032      //@ ensures \result == decl.getEndLoc();
033      public /*@ pure @*/ int getEndLoc() { return decl.getEndLoc(); }
034    
035    
036    // Generated boilerplate constructors:
037    
038      //@ ensures this.decl == decl;
039      protected VarDeclStmt(/*@ non_null @*/ LocalVarDecl decl) {
040         super();
041         this.decl = decl;
042      }
043    
044    // Generated boilerplate methods:
045    
046      public final int childCount() {
047         return 1;
048      }
049    
050      public final Object childAt(int index) {
051              /*throws IndexOutOfBoundsException*/
052         if (index < 0)
053            throw new IndexOutOfBoundsException("AST child index " + index);
054         int indexPre = index;
055    
056         int sz;
057    
058         if (index == 0) return this.decl;
059         else index--;
060    
061         throw new IndexOutOfBoundsException("AST child index " + indexPre);
062      }   //@ nowarn Exception;
063    
064      public final /*@non_null*/String toString() {
065         return "[VarDeclStmt"
066            + " decl = " + this.decl
067            + "]";
068      }
069    
070      public final int getTag() {
071         return TagConstants.VARDECLSTMT;
072      }
073    
074      public final void accept(Visitor v) { v.visitVarDeclStmt(this); }
075    
076      public final Object accept(VisitorArgResult v, Object o) {return v.visitVarDeclStmt(this, o); }
077    
078      public void check() {
079         super.check();
080         this.decl.check();
081      }
082    
083      //@ ensures \result != null;
084      public static VarDeclStmt make(/*@ non_null @*/ LocalVarDecl decl) {
085         VarDeclStmt result = new VarDeclStmt(decl);
086         return result;
087      }
088    }