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 GetsCmd extends AssignCmd
032    {
033      // denotes v := rhs
034    
035    
036    // Generated boilerplate constructors:
037    
038       //@ ensures this.v == v;
039       //@ ensures this.rhs == rhs;
040       protected GetsCmd(/*@ non_null @*/ VariableAccess v, /*@ non_null @*/ Expr rhs) {
041          super(v, rhs);
042       }
043    
044    // Generated boilerplate methods:
045    
046       public final int childCount() {
047          return 2;
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.v;
059          else index--;
060    
061          if (index == 0) return this.rhs;
062          else index--;
063    
064          throw new IndexOutOfBoundsException("AST child index " + indexPre);
065       }   //@ nowarn Exception;
066    
067       public final /*@non_null*/String toString() {
068          return "[GetsCmd"
069             + " v = " + this.v
070             + " rhs = " + this.rhs
071             + "]";
072       }
073    
074       public final int getTag() {
075          return TagConstants.GETSCMD;
076       }
077    
078       public final void accept(javafe.ast.Visitor v) { 
079          if (v instanceof Visitor) ((Visitor)v).visitGetsCmd(this);
080       }
081    
082       public final Object accept(javafe.ast.VisitorArgResult v, Object o) { 
083          if (v instanceof VisitorArgResult) return ((VisitorArgResult)v).visitGetsCmd(this, o); else return null;
084       }
085    
086       public void check() {
087          super.check();
088          this.v.check();
089          this.rhs.check();
090       }
091    
092       //@ ensures \result != null;
093       public static GetsCmd make(/*@ non_null @*/ VariableAccess v, /*@ non_null @*/ Expr rhs) {
094          GetsCmd result = new GetsCmd(v, rhs);
095          return result;
096       }
097    }