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 SynchronizeStmt extends Stmt
024 {
025 public /*@ non_null @*/ Expr expr;
026
027 public /*@ non_null @*/ BlockStmt stmt;
028
029 //@ invariant loc != javafe.util.Location.NULL;
030 public int loc;
031
032 //@ invariant locOpenParen != javafe.util.Location.NULL;
033 public int locOpenParen;
034
035
036 //@ public represents startLoc <- loc;
037 public /*@ pure @*/ int getStartLoc() { return loc; }
038 //@ also public normal_behavior
039 //@ ensures \result == stmt.getEndLoc();
040 public /*@ pure @*/ int getEndLoc() { return stmt.getEndLoc(); }
041
042
043 // Generated boilerplate constructors:
044
045 //@ ensures this.expr == expr;
046 //@ ensures this.stmt == stmt;
047 //@ ensures this.loc == loc;
048 //@ ensures this.locOpenParen == locOpenParen;
049 protected SynchronizeStmt(/*@ non_null @*/ Expr expr, /*@ non_null @*/ BlockStmt stmt, int loc, int locOpenParen) {
050 super();
051 this.expr = expr;
052 this.stmt = stmt;
053 this.loc = loc;
054 this.locOpenParen = locOpenParen;
055 }
056
057 // Generated boilerplate methods:
058
059 public final int childCount() {
060 return 2;
061 }
062
063 public final Object childAt(int index) {
064 /*throws IndexOutOfBoundsException*/
065 if (index < 0)
066 throw new IndexOutOfBoundsException("AST child index " + index);
067 int indexPre = index;
068
069 int sz;
070
071 if (index == 0) return this.expr;
072 else index--;
073
074 if (index == 0) return this.stmt;
075 else index--;
076
077 throw new IndexOutOfBoundsException("AST child index " + indexPre);
078 } //@ nowarn Exception;
079
080 public final /*@non_null*/String toString() {
081 return "[SynchronizeStmt"
082 + " expr = " + this.expr
083 + " stmt = " + this.stmt
084 + " loc = " + this.loc
085 + " locOpenParen = " + this.locOpenParen
086 + "]";
087 }
088
089 public final int getTag() {
090 return TagConstants.SYNCHRONIZESTMT;
091 }
092
093 public final void accept(Visitor v) { v.visitSynchronizeStmt(this); }
094
095 public final Object accept(VisitorArgResult v, Object o) {return v.visitSynchronizeStmt(this, o); }
096
097 public void check() {
098 super.check();
099 this.expr.check();
100 this.stmt.check();
101 }
102
103 //@ requires loc != javafe.util.Location.NULL;
104 //@ requires locOpenParen != javafe.util.Location.NULL;
105 //@ ensures \result != null;
106 public static SynchronizeStmt make(/*@ non_null @*/ Expr expr, /*@ non_null @*/ BlockStmt stmt, int loc, int locOpenParen) {
107 SynchronizeStmt result = new SynchronizeStmt(expr, stmt, loc, locOpenParen);
108 return result;
109 }
110 }