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 BreakStmt extends BranchStmt
023    { 
024    
025    // Generated boilerplate constructors:
026    
027       /**
028        * Construct a raw BreakStmt whose class invariant(s) have not
029        * yet been established.  It is the caller's job to
030        * initialize the returned node's fields so that any
031        * class invariants hold.
032        */
033       //@ requires I_will_establish_invariants_afterwards;
034       protected BreakStmt() {}    //@ nowarn Invariant,NonNullInit;
035    
036    
037    // Generated boilerplate methods:
038    
039       public final int childCount() {
040          return 1;
041       }
042    
043       public final Object childAt(int index) {
044               /*throws IndexOutOfBoundsException*/
045          if (index < 0)
046             throw new IndexOutOfBoundsException("AST child index " + index);
047          int indexPre = index;
048    
049          int sz;
050    
051          if (index == 0) return this.label;
052          else index--;
053    
054          throw new IndexOutOfBoundsException("AST child index " + indexPre);
055       }   //@ nowarn Exception;
056    
057       public final String toString() {
058          return "[BreakStmt"
059             + " label = " + this.label
060             + " loc = " + this.loc
061             + "]";
062       }
063    
064       public final int getTag() {
065          return TagConstants.BREAKSTMT;
066       }
067    
068       public final void accept(Visitor v) { v.visitBreakStmt(this); }
069    
070       public final Object accept(VisitorArgResult v, Object o) {return v.visitBreakStmt(this, o); }
071    
072       public void check() {
073          super.check();
074       }
075    
076       //@ requires loc != javafe.util.Location.NULL;
077       //@ ensures \result != null;
078       public static BreakStmt make(Identifier label, int loc) {
079          //@ set I_will_establish_invariants_afterwards = true;
080          BreakStmt result = new BreakStmt();
081          result.label = label;
082          result.loc = loc;
083          return result;
084       }
085    }