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