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 /* ---------------------------------------------------------------------- */ 023 024 /** Represents all variable declarations, including field declarations, 025 * local variables and formal arguments. 026 * 027 * We 'unroll' field and variable decls, 028 * so "<code>int x,y;</code>" becomes "<code>int x; int y;</code>". 029 * This unrolling can be detected by looking for sequential 030 * <code>VarDecl</code>s whose <code>Type</code> fields have the same 031 * starting location. 032 */ 033 034 public abstract class GenericVarDecl extends ASTNode 035 { 036 public int modifiers; 037 038 public ModifierPragmaVec pmodifiers; 039 040 public /*@ non_null @*/ Identifier id; 041 042 //@ invariant type.syntax; 043 public /*@ non_null @*/ Type type; 044 045 //@ invariant locId != javafe.util.Location.NULL; 046 public int locId; 047 048 public int getStartLoc() { return type.getStartLoc(); } 049 public int getEndLoc() { return type.getEndLoc(); } 050 public int getModifiers() { return modifiers; } 051 public void setModifiers(int m) { modifiers = m; } 052 053 054 // Generated boilerplate constructors: 055 056 /** 057 * Construct a raw GenericVarDecl whose class invariant(s) have not 058 * yet been established. It is the caller's job to 059 * initialize the returned node's fields so that any 060 * class invariants hold. 061 */ 062 //@ requires I_will_establish_invariants_afterwards; 063 protected GenericVarDecl() {} //@ nowarn Invariant,NonNullInit; 064 065 public void check() { 066 super.check(); 067 if (this.pmodifiers != null) 068 for(int i = 0; i < this.pmodifiers.size(); i++) 069 this.pmodifiers.elementAt(i).check(); 070 if (this.id == null) throw new RuntimeException(); 071 this.type.check(); 072 } 073 074 }