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