001    /* Copyright 2000, 2001, Compaq Computer Corporation */
002    
003    /* IF THIS IS A JAVA FILE, DO NOT EDIT IT!  
004    
005       Most Java files in this directory which are part of the Javafe AST
006       are automatically generated using the astgen comment (see
007       ESCTools/Javafe/astgen) from the input file 'hierarchy.h'.  If you
008       wish to modify AST classes or introduce new ones, modify
009       'hierarchy.j.'
010     */
011    
012    package javafe.ast;
013    
014    import javafe.util.Assert;
015    import javafe.util.Location;
016    import javafe.util.ErrorSet;
017    
018    // Convention: unless otherwise noted, integer fields named "loc" refer
019    // to the location of the first character of the syntactic unit
020    
021    
022    public class EvalStmt extends Stmt
023    {
024      public /*@ non_null @*/ Expr expr;
025    
026      public int getStartLoc() { return expr.getStartLoc(); }
027      public int getEndLoc() { return expr.getEndLoc(); }
028    
029    
030    // Generated boilerplate constructors:
031    
032      /**
033       * Construct a raw EvalStmt whose class invariant(s) have not
034       * yet been established.  It is the caller's job to
035       * initialize the returned node's fields so that any
036       * class invariants hold.
037       */
038      //@ requires I_will_establish_invariants_afterwards;
039      protected EvalStmt() {}    //@ nowarn Invariant,NonNullInit;
040    
041    
042    // Generated boilerplate methods:
043    
044      public final int childCount() {
045         return 1;
046      }
047    
048      public final Object childAt(int index) {
049              /*throws IndexOutOfBoundsException*/
050         if (index < 0)
051            throw new IndexOutOfBoundsException("AST child index " + index);
052         int indexPre = index;
053    
054         int sz;
055    
056         if (index == 0) return this.expr;
057         else index--;
058    
059         throw new IndexOutOfBoundsException("AST child index " + indexPre);
060      }   //@ nowarn Exception;
061    
062      public final String toString() {
063         return "[EvalStmt"
064            + " expr = " + this.expr
065            + "]";
066      }
067    
068      public final int getTag() {
069         return TagConstants.EVALSTMT;
070      }
071    
072      public final void accept(Visitor v) { v.visitEvalStmt(this); }
073    
074      public final Object accept(VisitorArgResult v, Object o) {return v.visitEvalStmt(this, o); }
075    
076      public void check() {
077         super.check();
078         this.expr.check();
079      }
080    
081      //@ ensures \result != null;
082      public static EvalStmt make(/*@ non_null @*/ Expr expr) {
083         //@ set I_will_establish_invariants_afterwards = true;
084         EvalStmt result = new EvalStmt();
085         result.expr = expr;
086         return result;
087      }
088    }